【发布时间】:2021-07-05 09:15:01
【问题描述】:
基于此以编程方式扩展 Azure 应用服务的方法: Is it possible to scale Azure app services programmatically, 我正在尝试使用 Azure.Management.Compute.ComputeManagementClient 为 Azure 云服务(经典)重新创建它。
这是我目前所拥有的。它在一定程度上有效,但我永远无法从 API 中列出我的云服务:
Dim credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(Client_Id, clientSecret, tenant_Id, AzureEnvironment.AzureGlobalCloud)
Dim client = New Microsoft.Azure.Management.Compute.ComputeManagementClient(credentials)
client.SubscriptionId = subscription_id
Dim servicesclient = client.CloudServices
Dim cloudservices = servicesclient.ListWithHttpMessagesAsync("MyResourceGroupName").Result.Body
到目前为止,一切似乎都按预期工作。如果我输入了 错误 资源组名称,则会收到资源组不存在的错误消息。但是,当我输入 right 资源组名称时,预期的云服务列表返回为空。可能存在某种许可问题,尽管我已经相当仔细地检查过了。还是这里的 CloudServices API 与我的“经典”云服务不同?还是我还缺少其他东西?
【问题讨论】:
-
我觉得sdk的使用需要严格按照文档使用。如果对文档不是很熟悉,不建议使用sdk。
-
如果我的回复有帮助,请采纳为答案(点击回复旁边的标记选项将其从灰色切换为填写。),请参阅meta.stackexchange.com/questions/5234/…
标签: azure azure-cloud-services azure-management-api