Azure Stack Powershell SQL

Adventures of a Cloud Operator: SQL Resource Provider on Azure Stack – Step 1: Deployment


This is for SQL Resource Provider (RP) 1.1.24.0 which is now superseded by 1.1.30.0 literally the next day after I executed the install. The only reason for posting this blog is to give a baseline for my update SQL RP post. The exact same install process will work for any newer Azure Stack deployments just skip the section where I rollback the PowerShell module version

This post will cover the deployment of the SQL RP with other posts in the series covering the various other steps and considerations

SQL Resource Provider on Azure Stack – Step 1: Deployment (this post)
SQL Resource Provider on Azure Stack – Step 2: Offering SQL Services (in progress)
SQL Resource Provider on Azure Stack – Step 3: Updating the SQL RP (in progress)

 

Prerequisites:

  • Conditional DNS forwarding is set correctly
  • Firewall is set correctly
  • Correct PKI certificates
  • Windows Server 2016 Datacenter image in Marketplace
  • PowerShell module version 1.4.0 (this is for SQL RP 1.1.24.0 or older)
  • SQL RP Source files

 

For this post, we’re going to assume your DNS, Firewall and Certs are all good. I’ll hopefully have time for another post to go over those topics in a bit more detail but for now we’ll consider them complete.

Before I continue, a quick shout out to the Azure Stack team as the docs again are spot on…. Honestly, the validity of anyone doing any technical blogs on Azure Stack is becoming less relative by the day… But I’ll continue to blog anyway Smile

The relative docs article for deploying the SQL RP to Azure Stack can be found here:
https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-sql-resource-provider-deploy

 

Windows Server 2016 Datacenter image in Marketplace

clip_image001[12]

If you don’t have it downloaded yet, kick this off now. Even if you’re not sure if you’ll deploy the SQL RP, get that image in your marketplace anyway.

Tip: if you’re new to the Marketplace, select the ‘Add from Azure’ button and you’ll open a whole world of Marketplace items

 

PowerShell module version 1.4.0 (not required for SQL RP 1.1.30.0)

On your Cloud Operator VM, close all powershell sessions as we’re going to rollback the module version. The reason we do this is the 1.1.24.0 RP install requires an older PS version.

For this I will be using PowerShell ISE (slowly making my way to VS Code) on the Cloud Operator VM. I suggest you use VS Code or ISE. Avoid using a straight up PowerShell window as we’ll want to be editing variables etc.

 

Import-Module -Name PowerShellGet -ErrorAction Stop
Import-Module -Name PackageManagement -ErrorAction Stop
Get-PSRepository -Name "PSGallery"

Uninstall-Module -Name AzureRM.AzureStackAdmin -Force
Uninstall-Module -Name AzureRM.AzureStackStorage -Force
Uninstall-Module -Name AzureStack -Force
Get-Module -Name Azs.* -ListAvailable | Uninstall-Module -Force

#Azure Stack 1804 or earlier.
Install-Module -Name AzureRm.BootStrapper
Use-AzureRmProfile -Profile 2017-03-09-profile -Force
Install-Module -Name AzureStack -RequiredVersion 1.4.0

Get-Module -Name "Azure*" -ListAvailable
Get-Module -Name "Azs*" -ListAvailable

Once complete, you’ll have the AzureStack 1.4.0 module installed and will be compatible with SQL RP 1.1.24.

 

SQL RP Source files

Download the RP installer assets from here:
https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-sql-resource-provider-deploy

image

Save all files and extract to c:\AzureStack-RPs\SQL. Also save a copy of your *.dbadapter PFX certificate here too
(My default folder for all RP sources is c:\AzureStack-RPs\)

image

 

 

SQL RP install process

In your PowerShell session, change directory to C:\AzureStack-RPs\SQL

Copy the install script from the docs page to your ISE session or modify in your favourite editor

Below is the script available on the docs site here
https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-sql-resource-provider-deploy#deploy-the-sql-resource-provider-using-a-custom-script

Modify the values to suit your environment. Leave the AzureEnvironment and Domain variables as default.

# Use the NetBIOS name for the Azure Stack domain. On the Azure Stack SDK, the default is AzureStack but could have been changed at install time.
$domain = "AZURESTACK"

# For integrated systems, use the IP address of one of the ERCS virtual machines
$privilegedEndpoint = "10.61.11.224"

# Provide the Azure environment used for deploying Azure Stack. Required only for Azure AD deployments. Supported environment names are AzureCloud, AzureUSGovernment, or AzureChinaCloud.
$AzureEnvironment = "AzureCloud"

# Point to the directory where the resource provider installation files were extracted.
$tempDir = 'C:\AzureStack-RPs\SQL'

# The service admin account can be Azure Active Directory or Active Directory Federation Services.
$serviceAdmin = "serviceadministrator@tenantname.onmicrosoft.com"
$AdminPass = ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass)

# Set credentials for the new resource provider VM local administrator account.
$vmLocalAdminPass = ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force
$vmLocalAdminCreds = New-Object System.Management.Automation.PSCredential ("sqlrpadmin", $vmLocalAdminPass)

# Add the cloudadmin credential that's required for privileged endpoint access.
$CloudAdminPass = ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force
$CloudAdminCreds = New-Object System.Management.Automation.PSCredential ("$domain\cloudadmin", $CloudAdminPass)

# Change the following as appropriate.
$PfxPass = Read-Host "PFX password" -AsSecureString
#$PfxPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force

# Change to the directory folder where you extracted the installation files. Do not provide a certificate on ASDK!
. $tempDir\DeploySQLProvider.ps1 `
-AzCredential $AdminCreds `
-VMLocalCredential $vmLocalAdminCreds `
-CloudAdminCredential $cloudAdminCreds `
-PrivilegedEndpoint $privilegedEndpoint `
-AzureEnvironment $AzureEnvironment `
-DefaultSSLCertificatePassword $PfxPass `
-DependencyFilesLocalPath $tempDir

Once started, watch it for a minute or so to ensure your logins and variables are all correct. After a min or go grab a coffee or find something else to do for a half hour.

image

After about 30 mins (mine took 28mins) the script should complete.

image

 

In the Admin Portal, go to the resource group system.region.sqladapter

image

In the overview page, you will see the varying resources deployed that make up the provider.

clip_image001[10]

Select Deployments and you can see the completed deployments

image

Back in the Admin Portal, refresh the page. I suggest closing the browser and reopening.

Select ‘All services’ and type sql in the filter field

image

At this stage you have successfully deployed the RP to your Azure Stack environment. This is the easy part.

In the next post I will cover adding SQL servers and some considerations as well as how to create offers and plans for your tenants.

That about wraps up this post, see you in the next one!

Happy stacking
Dan

Next post: SQL Resource Provider on Azure Stack – Step 2: Offering SQL Services

Leave a Reply