Installing Azure Stack Development Kit on my lab – Part II : Setup PowerShell Module for ASDK

Setup PowerShell Module for Azure Stack

Connect to Azure Stack by using Remote Desktop Connection

  1. Open Remote Desktop Connection and connect to the development kit. For the user name, enter AzureStack\AzureStackAdmin. Use the operator password that you specified when you set up Azure Stack.
  2. On the development kit computer, open Server Manager. Select Local Server, clear the Internet Explorer Enhanced Securitycheck box, and then close Server Manager.
  3. To open the user portal, go to https://portal.local.azurestack.external/. Sign in by using user credentials. To open the Azure Stack operator portal, go to https://adminportal.local.azurestack.external/. Sign in by using the ADFS credentials that you specified during installation.

Setup PowerShell Repository
Since my ADSK is running on internet disconnected environment, follow the steps below:
1. Download the PowerShell modules to a machine that has internet connection and transfer it to the server that is running ASDK

$Path = "C:\azurerm"

Save-Package `
-ProviderName NuGet `
-Source https://www.powershellgallery.com/api/v2 `
-Name AzureRM `
-Path $Path `
-Force `
-RequiredVersion 1.2.11

Save-Package `
-ProviderName NuGet `
-Source https://www.powershellgallery.com/api/v2 `
-Name AzureStack `
-Path $Path `
-Force `
-RequiredVersion 1.2.11

2. Copy the downloaded packages and transfer it to server running the ASDK.
3. 
Register the location as the default repository and install AureRM and AzureStack modules from this repository:

</span>$SourceLocation = "C:\azurerm”
$RepoName = "MyNuGetSource"
Register-PSRepository `
-Name $RepoName `
-SourceLocation $SourceLocation `
-InstallationPolicy Trusted

```powershell
Install-Module AzureRM `
-Repository $RepoName

Install-Module AzureStack `
-Repository $RepoName

To confirm the installation, run the following command:

Get-Module -ListAvailable | where-Object {$_.Name -like “Azure*”}

Download AzureStack-Tools from GitHub and transfer to ASDK server:

https://github.com/Azure/AzureStack-Tools
AzureStack-Tools is a GitHub repository that hosts PS module for managing and deploying resources to Azure Stack.  Download by running the following Script:


# Change directory to the root directory. 
 cd \

# Download the tools archive.
 invoke-webrequest `
   https://github.com/Azure/AzureStack-Tools/archive/master.zip `
   -OutFile master.zip

# Expand the downloaded files.
 expand-archive master.zip `
   -DestinationPath . `
   -Force

# Change to the tools directory.
 cd AzureStack-Tools-master

Import or Install Azure Stack Connect and Compute Modules. Since I am running in internet disconnect environment, I use AD FS based deployments:

# Navigate to the downloaded folder and import the **Connect** PowerShell module
Set-ExecutionPolicy RemoteSigned
Import-Module .\Connect\AzureStack.Connect.psm1
Import-Module .\ComputeAdmin\AzureStack.ComputeAdmin.psm1

# For Azure Stack development kit, this value is set to https://adminmanagement.local.azurestack.external. To get this value for Azure Stack integrated systems, contact your service provider.
$ArmEndpoint = " https://adminmanagement.local.azurestack.external"

# For Azure Stack development kit, this value is adminvault.local.azurestack.external
$KeyvaultDnsSuffix = “adminvault.local.azurestack.external”

# Register an AzureRM environment that targets your Azure Stack instance
Add-AzureRMEnvironment `
-Name "AzureStackAdmin" `
-ArmEndpoint $ArmEndpoint

# Get the Active Directory tenantId that is used to deploy Azure Stack
$TenantID = Get-AzsDirectoryTenantId `
-ADFS `
-EnvironmentName "AzureStackAdmin"

# Sign in to your environment
Login-AzureRmAccount `
-EnvironmentName "AzureStackAdmin" `
-TenantId $TenantID 

If you want to verify that everything is working, you can test it by creating a test resource group by running the following command:

New-AzureResourceGroup -Name "TestASDK-RSG01" -Location local