c# - How to get List of resources by resource type and resource group by using Azure Resource management apis -


how list of resource resource group using azure resource management api

i have install microsoft.azure.management.resourcemanager.fluent nuget package below script give me list of resource groups not list of resources per resource group.

        var credentials = sdkcontext.azurecredentialsfactory.fromserviceprincipal(clientid, clientsecret, tenantid, azureenvironment.azureglobalcloud);               var azure = azure.configure().authenticate(credentials).withsubscription(subscriptionid);         var resourecelist = azure.resourcegroups.list().tolist(); 

i looking similar available in powershell

get-azurermresource -resourcegroupname $batchresourcegroup -resourcetype 'microsoft.batch/batchaccounts' 

please have try following code list of resources. test on side, works correctly. use resources - list resource group rest api that.

  var resoucemanagementclient = new resourcemanagementclient(credentials) {subscriptionid = subscriptionid};   var resource = resoucemanagementclient.resourcegroups.listresourcesasync(resourcegroup,new odataquery<genericresourcefilterinner>(x=>x.resourcetype == "microsoft.batch/batchaccounts")).result; 

enter image description here


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -