Изучите некоторые примеры C# на GitHub здесь https://github.com/Azure/azure-sdk-for-net, чтобы узнать, как использовать клиент ARM для чтения определенных метаданных из сред Azure.В примере, приведенном ниже, я пытаюсь запросить виртуальные машины Azure в клиенте. Когда я следую примеру, код зависает менее чем на 3 минуты, а затем в конце концов истекает время ожидания из-за ошибки шлюза. "введите описание изображения здесь" src="https://i.sstatic.net/x6t4s5iI.png" />
Есть какие-нибудь советы или примеры обновлений, которым мне следует следовать?
Пример постоянной ссылки.
Источник:
// Lists all available Resource SKUs
[NUnit.Framework.Test]
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetComputeResourceSkus_ListsAllAvailableResourceSKUs()
{
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json
// this example is just showing the usage of "ResourceSkus_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotne ... mmand-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "{subscription-id}";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation and iterate over the result
await foreach (ComputeResourceSku item in subscriptionResource.GetComputeResourceSkusAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine($"Succeeded");
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... re-sdk-for
Как получить данные виртуальной машины Azure с помощью клиента ARM, используя примеры Azure/azure-sdk-for-net ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Можно ли скомпилировать программное обеспечение ARM Windows C++ на хосте ARM Windows?
Anonymous » » в форуме C++ - 0 Ответы
- 68 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Использование Arm Gnu Toolchain для компиляции файлов C++ для встроенной цели Arm Cortex-m4
Anonymous » » в форуме C++ - 0 Ответы
- 28 Просмотры
-
Последнее сообщение Anonymous
-