Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 208
Thadikaran K Avatar asked Sep 07 '25 04:09

Thadikaran K


1 Answers

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.

like image 165
Joy Wang Avatar answered Sep 11 '25 08:09

Joy Wang