This article is contributed. See the original author and article here.
One of our Azure customers raised a support ticket to find out the creation dates for all their resources on their Azure subscription.
This blog shows you one of the ways to achieve that.
Create an Azure service principal with the az ad sp create-for-rbac command. Make sure to copy the output, as it is required in the next steps.
az ad sp create-for-rbac –name serviceprincipalname –role reader
Creating ‘reader’ role assignment under scope ‘/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
The output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli
‘name’ property in the output is deprecated and will be removed in the future. Use ‘appId’ instead.
Generate the bearer token using Postman client – Postman API Platform
Type in the below URL with your tenant ID for a POST call
Click on “Body” and type in the details from the output of Step 1 as following.
Note: Client ID = App ID.
Click on “Send” and you will see a JSON response as below with a bearer/access token
Copy the access token which will now be used in Step 3 for a Get call.
Make the get call to get the creation dates of your resources on the subscription. You may also do it for a single resource by filtering as needed in the URL.
Get URL – https://management.azure.com/subscriptions/XXXX-Your-Subscription- IDXXXX/resources?api-version=2020-06-01&$expand=createdTime&$select=name,createdTime
Select “Bearer Token” in the Authorization tab and paste the access token copied from Step 2.
Click on Send and enjoy the results you wanted!
Credits to @P V SUHAS for the guidance.
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.