I'm looking to create a powershell script that identifies (and sends an e-mail) for any app registration secrets that are going to expire. I know how to obtain a list of ALL of our app registrations by running one of the below commands
Get-AzureADApplication -all $true
Or alternatively by finding one app registration
Get-AzureADApplication -filter "displayName -eq 'Our App Name'"
I'm interested in obtaining the object IDs of only a small subset of app registrations (like only 10) which I can then loop through to find the expiry dates.
I'm fine with the send e-mail piece, but does anyone know if this is possible to extract the subset of app registrations from azure?
CodePudding user response:
If you only want 10, you can use the -Top
parameter.
Get-AzureADApplication -Top 10
You can also use the -Top
parameter with the -Filter
parameter. I like to use the combination of StartsWith
to filter:
Get-AzureADApplication -Top 10 -Filter "startswith(displayName,'ABC')"