如何在使用 .NET SDK 创建虚拟机时获取 Azure 可用区提供的区域
我尝试使用 .NET SDK 获取可用区提供的区域信息,但无法获取与从门户创建虚拟机时在 Azure 上看到的完全相同的信息。
以下调用返回了巨大的数组列表,其中大多数条目都是空的,但其中很少有 [1 2 3]。此外,这需要很多时间。(大约需要 10-12 秒来获取数据)
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));
}
,例如,我只期望 [ 1 2 3 ] 针对“WesternEurope”。
知道如何获取相应的信息吗?
作为参考,以下代码片段。
少数没有区域信息的区域可以收集。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论