Instructions below are relative to the .\Infrastructure folder of the AzureStack-Tools repo. This also requires the Azure Stack Connect Module to be imported before running any of the commands. The Module can also be found in the AzureStack-Tools repo.
Whats new for TP3:
- New Cmdlet Name Prefix
- API Resource Name changes
- New cmdlets
- Use of Azure Stack Connect Module
Import-Module .\AzureStack.Infra.psm1Import-Module .\AzureStack.Connect.psm1You will need to reference your Azure Stack Administrator environment. To create an administrator environment use the below. The ARM endpoint below is the administrator default for a one-node environment.
Add-AzureStackAzureRmEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external"Connecting to your environment requires that you obtain the value of your Directory Tenant ID. For Azure Active Directory environments provide your directory tenant name:
$TenantID = Get-DirectoryTenantID -AADTenantName "<mydirectorytenant>.onmicrosoft.com" -EnvironmentName AzureStackAdminFor ADFS environments use the following:
$TenantID = Get-DirectoryTenantID -ADFS -EnvironmentName AzureStackAdminThen login:
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin" -TenantId $TenantIDExplains each individual command and shows how to use it
List active and closed Infrastructure Alerts
$credential = Get-Credential
Get-AzSAlert -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Alerts. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves Active & Closed Alerts
Close any active Infrastructure Alert. Run Get-AzureStackAlert to get the AlertID, required to close a specific Alert.
$credential = Get-Credential
Close-AzSAlert -AzureStackCredentials $credential -TenantID $TenantID -AlertID "ID" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to close active Alert. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Close active Alert
Review the Update Summary for a specified region.
$credential = Get-Credential
Get-AzSUpdateSummary -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Region Update Summary. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves Region Update Summary
Retrieves list of Azure Stack Updates
$credential = Get-Credential
Get-AzSUpdate -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Azure Stack Updates. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- List Azure Stack Updates
Applies a specific Azure Stack Update that is downloaded and applicable. Run Get-AzureStackUpdate to retrieve Update Version first
$credential = Get-Credential
Apply-AzSUpdate -AzureStackCredentials $credential -TenantID $TenantID -vupdate "Update Version" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to apply a specific Update. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Applies specified Update
Should be used to validate a specific Update Run or look at previous update runs
$credential = Get-Credential
Get-AzSUpdateRun -AzureStackCredentials $credential -TenantID $TenantID -vupdate "Update Version" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Update Run information. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists Update Run information for a specific Azure Stack update
Does list all Infrastructure Roles
$credential = Get-Credential
Get-AzSInfraRole -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Infrastructure Roles. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists Infrastructure Roles
Does list all Infrastructure Role Instances (Note: Does not return Directory Management VM in One Node deployment)
$credential = Get-Credential
Get-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Infrastructure Role Instances. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists Infrastructure Role Instances
Does list all Scale Units in a specified Region
$credential = Get-Credential
Get-AzSScaleUnit -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve Scale Units. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists Scale Units
Does list all Scale Units Nodes
$credential = Get-Credential
Get-AzSScaleUnitNode -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve all Scale Unit Nodes. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists Scale Unit Nodes
Does list all logical Networks by ID
$credential = Get-Credential
Get-AzSLogicalNetwork -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve logical Networks. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists logical Networks
Does return the total capacity of the storage subsystem
$credential = Get-Credential
Get-AzSStorageCapacity -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve total storage capacity. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Lists total storage capacity for the storage subsystem
Does list all file shares in the storage subsystem
$credential = Get-Credential
Get-AzSStorageShare -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve file shares. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all file shares
Does list all IP Pools
$credential = Get-Credential
Get-AzSIPPool -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve IP Pools. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all IP Pools
Does list all MAC Address Pool
$credential = Get-Credential
Get-AzSMacPool -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve all MAC Address Pools. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all MAC Address Pools
Does list all Gateway Pools
$credential = Get-Credential
Get-AzSGatewayPool -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve the Gateway Pools. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all Gateway Pools
Does list all SLB MUX Instances
$credential = Get-Credential
Get-AzSSLBMUX -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve all SLB MUX instances. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all SLB MUX instances
Does list all Gateway Instances
$credential = Get-Credential
Get-AzSGateway -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to retrieve all Gateway instances. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Retrieves all Gateway instances
Does start an Infra Role Instance
$credential = Get-Credential
Start-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -Name "InfraRoleInstanceName" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to start an infra role instance. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Starts an Infra Role instance
Does stop an Infra Role Instance
$credential = Get-Credential
Stop-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -Name "InfraRoleInstanceName" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to stop an infra role instance. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Stops an Infra Role instance
Does restart an Infra Role Instance
$credential = Get-Credential
Restart-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -Name "InfraRoleInstanceName" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to restart an infra role instance. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Restart an Infra Role instance
Does add an IP Pool
$credential = Get-Credential
Add-AzSIPPool -AzureStackCredentials $credential -TenantID $TenantID -Name "PoolName" -StartIPAddress "192.168.55.1" -EndIPAddress "192.168.55.254" -AddressPrefix "192.168.0./24" -EnvironmentName "AzureStackAdmin"Note: The cmdlet requires credentials to add an IP Pool. Provide the administrator Azure Active Directory credentials, such as <Admin Account>@<mydirectory>.onmicrosoft.com or the ADFS credentials, to the prompt.
The command does the following:
- Authenticates to the Azure Stack environment
- Adds an IP Pool
Demonstrates using multiple commands together for an end to end scenario.
#Declare Credentials
$credential = Get-Credential
#Retrieve all Alerts and apply a filter to only show active Alerts
$Active=Get-AzSAlert -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"|where {$_.state -eq "active"}
#Stop Infra Role Instance
Stop-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin" -Name $Active.resourceName
#Start Infra Role Instance
Start-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin" -Name $Active.resourceName
#Validate if error is resolved (Can take up to 3min)
Get-AzSAlert -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"|where {$_.state -eq "active"}