如何使用Azure Resource Management API获取资源组的资源列表
我已经安装了Microsoft.Azure.Management.ResourceManager.Fluent Nuget包下面的脚本只给出了资源组列表,但没有给出每个资源组的资源列表 .
var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);
var azure = Azure.Configure().Authenticate(credentials).WithSubscription(subscriptionID);
var resourecelist = azure.ResourceGroups.List().ToList();
我正在寻找类似于powershell中可用的东西
Get-AzureRmResource -ResourceGroupName $batchResourceGroup -ResourceType 'Microsoft.Batch/batchAccounts'
1 回答
请尝试使用以下代码获取资源列表 . 我测试它在我身边,它正常工作 . 我们也可以使用Resources - List By Resource Group Rest API来做到这一点 .