How to create azure stack in azure cloud

291 Views Asked by At

We are creating Azure stack in azure cloud by following docs of Microsoft Azure.

We are stuck at this documentaion : https://learn.microsoft.com/en-us/azure/azure-stack/azure-stack-policy-module

at this heading : Apply policy to a resource group

$resourceGroupName = ‘myRG01’
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
$policy = New-AzureRmPolicyDefinition -Name AzureStackPolicyDefinition -Policy (**Get-AzureStackRmPolicy**)
New-AzureRmPolicyAssignment -Name AzureStack -PolicyDefinition $policy -Scope /subscriptions/$subscriptionID/resourceGroups/$rgName

when we are running the above PowerShell script, we observe the below mentioned error:

Get-AzureStackRmPolicy : The term 'Get-AzureStackRmPolicy' is not recognized as the name of a cmdlet, function, script file, or operable 
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:81
+ ... ion -Name AzureStackPolicyDefinition -Policy (Get-AzureStackRmPolicy)
+                                                   ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-AzureStackRmPolicy:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
2

There are 2 best solutions below

0
On BEST ANSWER

When we replaced Get-AzureStackRmPolicy with Get-AzsPolicy we were able to create all the resources, We got this after looking in to the script provided by Microsoft in their github repo.

5
On

Note: Microsoft Azure Stack is a hybrid cloud platform that lets you provide Azure services from your datacenter.

If you already installed Azure Stack on your datacenter, you can use the following cmdlet after installing PowerShell for Azure Stack.

For more details, refer “Azure Stack documentation”.