简体   繁体   中英

Get list of Virtual machine sizes in a region using Azure Service Management (Classic) API

How can i get the list of available virtual machine sizes in a particular azure location. I have seen that there is an endpoint available in resource manager API for the same at: https://msdn.microsoft.com/en-us/library/azure/mt269440.aspx Is same information is available through Azure Service Management (Classic) API?

try with below code this will work for me

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(); 

i am using Microsoft.Azure.Management.Compute.dll , v10.0.0.0 version for this . upper example i am using token base authentication. you can also try with certificate base authentication.

The following reference document suggests that it should be possible.

URI Parameter

location - Optional. Returns VM Images from the specified location.The location parameter is only available using version 2014-05-01 or higher.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM