0

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
Manglu
  • 10,744
  • 12
  • 44
  • 57
focode
  • 648
  • 1
  • 16
  • 39
  • Did you import the module? – Itchydon Aug 02 '17 at 07:16
  • 1
    Azure Stack hosts Azure services in your "data centre", NOT in the public cloud. Azure Stack Policy is only used to restrict the services that can be used by the Azure Stack. Do you have Azure Stack environment? – Mihir Aug 02 '17 at 07:18
  • a. it is possible to [install Azure Stack in Azure](https://azurestack.blog/2017/07/deploy-azure-stack-development-kit-on-an-azure-vm/). b. this is not installing Azure Stack article. c. did you install Azure Stack powershell module? – 4c74356b41 Aug 02 '17 at 07:21
  • No, You don't deploy Azure Stack in public Cloud. There was a 'Software-only" version of Azure Stack around a year ago. But, it was dropped. Azure Stack is only available as a package of "Hardware and Azure services" for data centres. – Mihir Aug 02 '17 at 07:35
  • there still is, check the link I provided if you don't believe me. the post is several weeks old. @Mihir – 4c74356b41 Aug 02 '17 at 09:49
  • Thanks @4c74356b41, Interesting to see that Azure Stack TP2 and TP3 is still around and being used. But, officially 'Azure Stack' only comes as an appliance. It is meant to work together with Azure to support hybrid deployments. – Mihir Aug 02 '17 at 14:46

2 Answers2

0

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.

focode
  • 648
  • 1
  • 16
  • 39
-2

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”.

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
  • Hi Pradeep, thanks for your reply , We were creating Azure Stack in Azure Cloud and we faced this problem. I think their powershell script and documentation is not updated. – focode Aug 02 '17 at 08:19
  • You cannot create Azure Stack in Azure Cloud because it is a public cloud platform, where Azure Stack is a hybrid cloud platform. In order to use Azure Stack you need to setup your own hardware and download Azure Stack Deployment Kit and install Azure Stack on your Datacenter. Kindly understand how does Azure Stack works. https://learn.microsoft.com/en-in/azure/azure-stack/ – CHEEKATLAPRADEEP Aug 02 '17 at 08:43
  • you can create azure stack in azure cloud, not that its supported or viable, but possible – 4c74356b41 Aug 02 '17 at 09:48
  • Refer the MSDN thread for information: https://social.msdn.microsoft.com/Forums/azure/en-US/48713059-d25c-4e3b-a245-0fdd424a4449/azure-stack-deployment-in-azure-vm?forum=AzureStack – CHEEKATLAPRADEEP Aug 02 '17 at 09:57
  • Azure Stack is type of a hybrid cloud. You can't install it on Public cloud. You can get the experience of Azure Stack by installing Azure Stack Deployment kit on public Azure also. But you required high end VM on cloud. Follow the document. https://learn.microsoft.com/en-us/azure-stack/asdk/asdk-install?view=azs-1908 – vish Nov 20 '19 at 05:13