Last active
February 19, 2019 03:06
-
-
Save random82/59180ed5c383d3b1b67def9413adf809 to your computer and use it in GitHub Desktop.
Synchrosing Azure Resource Providers across subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[String] | |
$sourceAzureSubscriptionId, | |
[String[]] | |
$targetAzureSubscriptionIds | |
) | |
Select-AzureRmSubscription -Subscription $sourceAzureSubscriptionId | |
$registeredProviders = Get-AzureRmResourceProvider | Where {$_.RegistrationState -eq "Registered"} | |
Write-Output "These providers will be restered in target subscription:" | |
$registeredProviders | foreach { | |
Write-Output $_.ProviderNamespace | |
} | |
$targetAzureSubscriptionIds | foreach { | |
Select-AzureRmSubscription -Subscription $_ | |
$registeredProviders | foreach {Register-AzureRmResourceProvider -ProviderNamespace $_.ProviderNamespace } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment