AzureStack on Azure – Part 2

Let the registering begin! So you’ve got a working Azure Stack on Azure, which is like some kind of crazy inception thing. But let’s be honest with each other, there’s not a whole lot to do on Azure Stack at this point. You could like provision a VNet, maybe set up some sweet Resource Groups, but if you want to do something useful – like create some VMs or deploy services – you’re going to want to register your Azure Stack with Azure and syndicate with the marketplace. So let’s go ahead and do that using the Register-AzureStackLAB.ps1.

Azure Stack Registration

The Register-AzureStackLAB.ps1 script is copied to the C:\AzureStackonAzureVM folder during the creation of the Azure VM. For the script you will need to provide the CloudAdmin credentials

Cloud Admin credentials

and the Azure Subscription ID

Azure Subscription ID

you’ll be using to register your Azure Stack.

You can go ahead and run the following two commands:

$cloudAdminCredential = Get-Credential -UserName "AzureStack\CloudAdmin" -Message "CloudAdmin Credentials"
$subscriptionID = "YourAzureSubscriptionID"

Then execute the script:

.\Register-AzureStackLAB.ps1 -CloudAdminCredential $cloudAdminCredential -AzureSubscriptionId $subscriptionID

Register script execution

The script does a few useful things. It copies the GitHub files for the Resource Providers, which we’ll use in part three. It then removes the current Azure PowerShell modules and installs the correct version of the Azure and AzureStack PowerShell modules that will work with Azure Stack.

Azure PowerShell install

Then the script runs the Add-AzureRMAccount command, which replaces the Login-AzureRMAccount command, since Login is not an approved PowerShell verb. And someone in the PowerShell community got real angry about that. It was a whole thing, don’t ask. You’ll be prompted for an account that is an Owner of the Subscription.

Azure subscription login

Once that account is added, the script will register the AzureStack provider with your subscription, then download and import the Registration module from AzureStack-tools on GitHub. Maybe at some point the tools will make their way into the AzureStack module proper, but for now they’re still separate. The registration module is imported, and the Set-AzSRegistration command is run. That will invoke some remote commands on the AzS-ERCS01 privileged endpoint, which is why the CloudAdmin account is required. At the end of the script you should see something like this.

Completed registration

Azure Stack Offer and Plan Creation

While we’re running scripts, let’s keep the party going. At this point your Azure Stack is syndicated with the Azure Marketplace, but there aren’t any user subscriptions on your Azure Stack to start consuming all this goodness. There is the Default Provider Subscription, which is used by the Admin console, but that is not how regular users are going to be consuming Azure Stack. Let’s go ahead and create a Plan and Offer, and then create a user subscription.

Plans are a collection of one or more services in Azure Stack and quotas for that service.

Base Plan Example

For instance, you might include the Compute service in a plan, but restrict the subscriber to 10 cores of compute. That’s pretty important on a limited system like the Azure Stack Dev Kit, or even on a multi-node deployment of Azure Stack.

An Offer is a collection of a Base Plan and some optional add-on plans.
Base Offer Example So you could include the MSSQL resource provider as an add-on plan, which the subscriber can choose to activate. The Offers can be public or private, and you can control who can actually create a subscription based on an offer. Pretty heady stuff, I know. So we are going to create a basic plan and offer using the Create-OfferandPlan.ps1 script located in the same C:\AzureStackonAzureVM folder. The only required argument is the identity of the Subscription Owner, which in my case I use the existing admin account:

Create Offer and Plan

You will be prompted to enter credentials, which the script uses to connect to the Default Provider Subscription.

Azure Stack Admin Login

The script retrieves the quotas stored in the Default Provider Subscription, creates a Resource Group for Plans and Offers – creatively called PlansAndOffers – and then creates a plan and offer with the standard Compute, Storage, Network, and Key Vault services. Lastly, the script creates a user subscription using the generated offer for the user specified.
Offer Success Now we can log into the user portal and start consuming services.
User Subscription But before we do that, let’s add some items from the marketplace so there are actually things to create!

Add Items from the Marketplace

There’s not really a good way to add marketplace content from PowerShell yet… yet. Suffice to say I am working on it, and I’ll have something eventually. In the meantime, however, we’ll need to use the Admin portal. There should be a link on the desktop, or you can use the following address: https://adminportal.local.azurestack.external. Once logged in, you can click on the Marketplace Management item. Azure Stack Admin Portal The local Marketplace will be empty, so go ahead and click the Add from Azure button to be take to the full list of items. Add from Azure In order to add the MySQL, MSSQL, and AppService resource providers, you are going to need to download some specific images. Images to Add The Windows Server 2016 images weigh in at a hefty 127GB per image! Suffice to say the download will take a while. In fact that’s probably a good place to stop the post. Next time we’ll be adding the MSSQL, MySQL, and AppService resource providers. See you then!

Leave a Reply

Your email address will not be published. Required fields are marked *