使用 Azure 服务管理(经典)API 获取区域中的虚拟机大小列表



如何获取特定 Azure 位置中可用虚拟机大小的列表。我已经看到资源管理器 API 中有一个可用于相同位置的端点:https://msdn.microsoft.com/en-us/library/azure/mt269440.aspx是否可以通过 Azure 服务管理(经典)API 获得相同的信息?

请尝试使用以下代码,这将对我有用

AuthenticationContext authenticationContext = new AuthenticationContext(your - authserviceurl + your - tenantdomain);
UserCredential uc = new UserCredential(Api - username, Api - password);
token = authenticationContext.AcquireToken("https://management.core.windows.net/", API - nativetenantid, uc);
var credentials = new TokenCredentials(token);
var computeClient = new ComputeManagementClient(credentials) { SubscriptionId = Your - SubscriptionId };
var virtualMachineSize = computeClient.VirtualMachineSizes.List(locationName).ToList(); 

我正在使用Microsoft.Azure.Management.Compute.dll,v10.0.0.0版本。上面的示例我正在使用基于令牌的身份验证。您还可以尝试使用基于证书的身份验证。

以下参考文档建议这应该是可能的。

URI 参数

位置 - 可选。从指定位置返回 VM 映像。位置参数仅适用于版本 2014-05-01 或更高版本。

最新更新