Getting all automainton account names of a tenant

Jafari, shahab 1 Reputation point
2022-02-26T09:25:25.877+00:00

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
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,196 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 104K Reputation points MVP
    2022-02-26T09:45:08.953+00:00

    Hi @Jafari, shahab ,

    this should be possible with this PowerShell command:

    Get-AzAutomationAccount -ResourceGroupName "xyz"  
    

    https://learn.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

    0 comments No comments