How to get Azure ResourceManagementClient object tags

I am trying to get a list of tags from resource groups with the ResourceManagementClient class.

'Microsoft.Azure.Management.Resources 2.14.1-preview' is added from the package manager console

ResourceManagementClient resourceClient = new ResourceManagementClient(new Microsoft.Azure.CertificateCloudCredentials(SubscriptionId, cert));

var tags = resourceClient.Tags.List();

I get this error; Authentication: Authentication failed. The heading "Authorization" is missing or presented in an invalid format.

In another example, the part works below;

StorageManagementClient storageClient = new StorageManagementClient(new Microsoft.WindowsAzure.CertificateCloudCredentials(SubscriptionId, cert));

There is a difference between these pieces of code. Microsoft.Azure is used for the first sample and Microsoft.WindowsAzure is used for the second and second sample works.

How can I fix the problem in the first example, can you explain the problem?

+4
1

, ResourceManagementClient CertificateCloudCredentials, , ARM Rest API. , /, , ResourceManagementClient

Update: , AD - . AD , - . ( /, ) , ResourceManagementClient, - ( ):

var credentials = new TokenCloudCredentials(<subscrtiption id>, <token>);
new ResourceManagerClient(credentials).DoSomething();
+3

All Articles