question

Jafarishahab-1084 avatar image
0 Votes"
Jafarishahab-1084 asked AndreasBaumgarten commented

Getting all automainton account names of a tenant

Hello,
Is there any way that i could get all automation account names of our tenant by a script? I am a global admin of the tenant.

Regards
Shahab

azure-automation
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Jafarishahab-1084 ,

did the answer work for you? Are there any additional questions to this topic?

If you found the answer helpful, it would be great if you please mark it "Accept as answer". This will help others to find answers in Q&A


Regards
Andreas Baumgarten

0 Votes 0 ·

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered AndreasBaumgarten edited

Hi @Jafarishahab-1084 ,

this should be possible with this PowerShell command:

 Get-AzAutomationAccount -ResourceGroupName "xyz"

https://docs.microsoft.com/en-us/powershell/module/az.automation/get-azautomationaccount?view=azps-7.2.0#example-1--get-all-accounts

You need to have the AZ module installed.
If you have automation accounts in different Resource Groups you might to get the Resource Groups first and use a for-each-Object around. This should look like this:

 Get-AzResourceGroup | ForEach-Object {
   Get-AzAutomationAccount -ResourceGroupName $_.ResourceGroupName }

[Update 2/27/2022] I just learned it's even more simple, because Get-AzAutomationAccount doesn't require the Resource Group Name. Thanks to @tbgangav-MSFT

Just run this and you get all Automation Accounts:

 Get-AzAutomationAccount


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.