How to get Azure Availability Zone provided region while creating Virtual Machine using .NET SDK
Muhammad Usman Khalil
1
Reputation point
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.
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,044 questions
Developer technologies | C#
11,579 questions
Sign in to answer