K.Pil
K.Pil

Reputation: 986

Use multiple subscription in a single Azure Power shell command

I am using following command :

Select-AzureRMSubscription -SubscriptionId $subscriptionID
Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $resourceGroupName -ServerName $servername -DatabaseName $dbServer.DatabaseName -StorageAccountName $storageAccount

Storage Account and DB server belong to different subscriptions , how can I execute a command that will allow to access resources from multiple subscription

Upvotes: 1

Views: 1059

Answers (2)

Manoher Kumar
Manoher Kumar

Reputation: 281

You can use following command to select subscription :-

az account set --subscription "Subscription Name or Subscription Id"

Image of Azure multiple subscription

Upvotes: 1

Jason Ye
Jason Ye

Reputation: 13974

how can I execute a command that will allow to access resources from multiple subscription

We can share your resource groups to different subscriptions, to achieve this, we should invite user B(subscription 2) to AAD (subscription 1), and grant resource group permission to user B, then we can use PowerShell to get the resource groups. enter image description here

Here a similar case about you, please refer to it.

Upvotes: 1

Related Questions