Elodie
Elodie

Reputation: 103

Azure Resource Manager - Get all the resources of a resource group

Yesterday, I was using this line of code with the version 1.5.0-preview of Microsoft.Azure.Management.ResourceManager :

var listResources = 
ResourceManagementClient.ResourceGroups.ListResources(resourceGroup.Name);

Today, I have updated to version 1.6.0-preview but the fonction doesn't seem to be available anymore. Is there another way to get the list of the resources contained in a resource group ?

Upvotes: 7

Views: 3199

Answers (1)

Tom Sun
Tom Sun

Reputation: 24529

Now the SDK is still preview version. In the 1.6.0 preview version. It should use following code.

   var listResources = resourceManagementClient.Resources.ListByResourceGroup("ResourceGroup Name");

But it still can't work correctly on my side because the API-Version is api-version=2017-05-10. I catch the request with fiddler.

enter image description here

The code you mentioned that use API-version

var listResources = 
ResourceManagementClient.ResourceGroups.ListResources(resourceGroup.Name);

enter image description here

Note : Please still use 1.5.0-preview instead of 1.6.0-preview currently if you want get group resource, or give your feedback to azure sdk team . Or you can use REST API directly

Upvotes: 8

Related Questions