1 year ago
#278821
Usman
How to get Azure Availability Zone provided region while creating Virtual Machine using .NET SDK
I am trying to get Availability Zone provided the region information using .NET SDK but I am not able to get the exact same information which I can see on Azure while creating virtual machine from portal.
Following call returning me huge list of array where most of the entries are empty but few of them having [1 2 3]. Moreover, it takes alot of time.( around 10-12 seconds to bring the data )
var connection = GetAzConnection(subscriptionId);
List<string> ZoneInfo = new List<string>();
var skus = connection.ComputeSkus.ListbyRegionAndResourceType(Region.Create(regionName),ComputeResourceType.VirtualMachines);
foreach (IComputeSku sku in skus)
{
var regionZones = sku.Zones;
ZoneInfo.Add(RegionZoneToString(regionZones));
}
While I am expecting just [ 1 2 3 ] against 'WesternEurope' for example.
Any idea how to get that corresponding info?
For reference, following code snippet.
Few regions where there are no zones information can be collected.
c#
.net
azure
azure-management-api
0 Answers
Your Answer