Automatically add newly created subscriptions to Azure Auromation Managed Identity

Shekar Yenagandula 116 Reputation points
2022-11-08T07:36:49.043+00:00

In Azure Automation, running task to enable soft delete across all subscription.
For running across subscriptions, I have to add all the subscriptions to the Identity with the permission.
Let's assume if we are creating new subscriptions it should be added automatically to the Identity.
I tried and it's seems like not possible through Azure Automation.
Any suggestions?
I have code to get all the subscriptions and add it to identity but I want to run it scheduled and In Azure environment if possible.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,159 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Roderick Bant 2,051 Reputation points
    2022-11-08T17:01:56.767+00:00

    The solution I tend to use is create a Management Group structure in Azure where you assign a role to the managed identity at the management group level and place the subscription in that management group, you will be able to manage the resources within the subscription without having to do a lot of individual role assignments.

    See the documentation on Management Groups for details.


  2. Maxim Sergeev 6,566 Reputation points Microsoft Employee
    2022-11-09T04:32:45.617+00:00

    HI there,

    You can't start managing the subscriptions by using Azure Automation without adding to them be managed by Azure Automation (which requires to have Managed Identity enabled).

    You can do this by using powershell, but outside of azure automation account, for example in Azure DevOps pipelines (but it will require to have at least a contributor role as well)
    https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/howto-assign-access-powershell

    0 comments No comments

  3. Luke Murray 10,611 Reputation points MVP
    2022-11-09T06:13:50.863+00:00