Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get-cloudrive
invoke-webrequest https://github.com/Azure/AzureStack-Tools/archive/master.zip -OutFile master.zip
expand-archive master.zip -DestinationPath . -Force
cd AzureStack-Tools-master
Import-Module .\Policy\AzureStack.Policy.psm1
Get-AzureRMSubscription
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
$policy = New-AzureRmPolicyDefinition -Name AzureStackPolicyDefinition -Policy (Get-AzsPolicy)
$subscriptionID = $s.Subscription.SubscriptionId
New-AzureRmPolicyAssignment -Name AzureStack -PolicyDefinition $policy -Scope /subscriptions/$subscriptionID
$rgName = 'myRG01'
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
$policy = New-AzureRmPolicyDefinition -Name AzureStackPolicyDefinition -Policy (Get-AzsPolicy)
New-AzureRmPolicyAssignment -Name AzureStack -PolicyDefinition $policy -Scope /subscriptions/$subscriptionID/resourceGroups/$rgName
$rgName = 'myRG01'
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
Remove-AzureRmPolicyAssignment -Name "AzureStack" -Scope /subscriptions/$subscriptionID/resourceGroups/$rgName
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
Remove-AzureRmPolicyAssignment -Name "AzureStack" -Scope /subscriptions/$subscriptionID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment