Thadikaran K
Thadikaran K

Reputation: 147

How to get all azure app registrations and view expiry date of secrets using a app registrations and azure cli commands?

I am trying to get all the azure app registrations and view expiry date of secrets using a app registrations and azure cli commands, provided below permissions to the app registration. enter image description here

But, getting below message while login in to the Azure AD using the service principal name and cli commands.

enter image description here

Also, This --allow-no-subscriptions option did not help.

enter image description here

Please share your suggestions and comments. Thank you in Advance.

Upvotes: 4

Views: 9336

Answers (1)

Joy Wang
Joy Wang

Reputation: 42063

The first error means your service principal is not in any Azure Subscription, as you used, you could use --allow-no-subscriptions to solve this.

The second error means your service principal does not have the permission to run the command az ad app list, i.e. list the app registrations in the AAD tenant.

To solve the issue, you have two options.

1.Add permission Application permission in Azure Active Directory Graph e.g. Application.Read.All(Note: Not Microsoft Graph).

enter image description here

enter image description here

enter image description here

2.Give an Azure AD admin role e.g. Application Administrator to your service principal as mentioned in the comment, follow this doc.

Upvotes: 3

Related Questions