Skip to content

Instantly share code, notes, and snippets.

@random82
Last active February 19, 2019 03:06
Show Gist options
  • Save random82/59180ed5c383d3b1b67def9413adf809 to your computer and use it in GitHub Desktop.
Save random82/59180ed5c383d3b1b67def9413adf809 to your computer and use it in GitHub Desktop.
Synchrosing Azure Resource Providers across subscriptions
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