Blog post and everyone talked about how to deploy Microsoft's latest hybrid cloud technology Microsoft Azure Stack, so since Azure stack has been deployed, we can consider creating a storage account (blob or table), launch our first virtual machine, and tenant/schedule , or publish more content to the existing Azure stack market. But before we do the next step, we need our MSA environment ready to accept PowerShell connections. We need additional modules and tools to run the existing Azurerm command for the Azure stack local subscription.
By using the Windows Management Framework 5.0, we can have a better way to share PowerShell work in a predefined format with other community members so that anyone can easily use these tools in the organization. Using the new package manager named "Powershellget", you can search the public or private repositories to find the PowerShell modules you need. By default, there is a repository named Psgallery, which we can use to produce the following commands:
Get-psrepository
To register the Psgallery repository, run the following command:
Set-psrepository-name "Psgallery"-installationpolicy Trusted
To install the required version of the PowerShell module:
Azure Stack installs API version profiles that are compatible with the Azurerm module, and the Azurerm.bootstrapper module provides the PowerShell commands required to use the API version configuration file. Install the Azurerm.bootstrapper module using the following command:
Install-module-name Azurerm.bootstrapper
Install the 2017-03-09 configuration file version of the Azurerm module for compute, storage, network, KeyStore, and so on:
Use-azurermprofile-profile 2017-03-09-profile
Install Azure stack-specific PowerShell modules, such as Azurestackadmin and Azurestackstorage:
Install-module-name azurestack-requiredversion 1.2.10
To see if the desired version of the PowerShell module was installed successfully:
get-module-listavailable | Where-object {$_. Name-like "azure*"}
Download and unzip Azure Stack Tools from GitHub:
Invoke-webrequest Https://github.com/Azure/AzureStack-Tools/archive/master.zip-OutFile Master.zip
Expand-archive Master.zip-destinationpath. -force
CD Azurestack-tools-master
Configuring the PowerShell Environment
To import the Connect PowerShell module:
Register AZURERM Environment (Manage Environment User environment two select one):
Management environment:
Add-azurermenvironment-name "Azurestackadmin"-armendpoint "https://adminmanagement.local.azurestack.external"
User environment:
Add-azurermenvironment-name "Azurestackuser"-armendpoint "https://management.local.azurestack.external"
Set the Graphendpointresourceid value using the following PS command:
Management environment:
Set-azurermenvironment-name "Azurestackadmin"-graphaudience "https://graph.windows.net/"
User environment:
Set-azurermenvironment-name "Azurestackuser"-graphaudience "https://graph.windows.net/"
Get the GUID value for the Active Directory tenant used to deploy the azure stack (using AAD deployment)
$TenantID = Get-azsdirectorytenantid-aadtenantname "wuyvzhanghotmail.onmicrosoft.com"-environmentname " Azurestackadmin "
Log in to Azure Stack
Administrator:
Login-azurermaccount-environmentname "Azurestackadmin"-tenantid $TenantID
User:
Login-azurermaccount-environmentname "Azurestackuser"-tenantid $TenantID
Registering a resource provider:
After you log on to the administrator or user portal, you can issue an action for the resource provider registered in the subscription. By default, all underlying resource providers are registered in the default provider subscription (Administrator subscription). When you operate on a newly created user subscription, if those subscriptions do not deploy any resources through the portal, you should register the resource provider for this subscription by using the following command
foreach ($s in (get-azurermsubscription)) {
Select-azurermsubscription-subscriptionid $s. SubscriptionId | Out-null
Write-progress $ ($s. SubscriptionId + ":" + $s. Subscriptionname)
get-azurermresourceprovider-listavailable | Register-azurermresourceprovider-force
}
To register an azure Stack on Azure:
Allow the following PS command to register Azure Stack with Azure:
C:\AzureStack-Tools-master\Registration\RegisterWithAzure.ps1-azureDirectory wuyvzhanghotmail.onmicrosoft.com- Azuresubscriptionid E5a2e705-e06f-454e-bbce-41d3bbeb1b9f-azureaccountid [email protected]
Sign in to the Azure stack management side to see that azure stack can already invoke some of the resources in Azure:
Configure Azure Stack Management with PowerShell