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.
Import-Module .\AzureStack.Infra.psm1
You will need to login to 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-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external"
Then login:
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin"
If you are not using your home directory tenant, you will need to supply the tenant ID to your login command. You may find it easiest to obtain using the Connect tool. For Azure Active Directory environments provide your directory tenant name:
$TenantID = Get-AzsDirectoryTenantId -AADTenantName "<mydirectorytenant>.onmicrosoft.com" -EnvironmentName AzureStackAdmin
For ADFS environments use the following:
$TenantID = Get-AzsDirectoryTenantId -ADFS -EnvironmentName AzureStackAdmin
Explains each individual command and shows how to use it
List active and closed Infrastructure Alerts
Get-AzsAlert
The command does the following:
- Retrieves Active & Closed Alerts
Close any active Infrastructure Alert. Run Get-AzsAlert to get the AlertID, required to close a specific Alert.
Close-AzsAlert -AlertID "ID"
The command does the following:
- Close active Alert
Review the Update Summary for a specified region.
Get-AzsUpdateLocation
The command does the following:
- Retrieves Region Update Summary
Retrieves list of Azure Stack Updates
Get-AzsUpdate
The command does the following:
- List Azure Stack Updates
Applies a specific Azure Stack Update that is downloaded and applicable. Run Get-AzureStackUpdate to retrieve Update Version first
Install-AzsUpdate -Update "Update Version"
The command does the following:
- Applies specified Update
Should be used to validate a specific Update Run or look at previous update runs
Get-AzsUpdateRun -Update "Update Version"
The command does the following:
- Lists Update Run information for a specific Azure Stack update
Does list all Infrastructure Roles
Get-AzsInfrastructureRole
The command does the following:
- Lists Infrastructure Roles
Does list all Infrastructure Role Instances (Note: Does not return Directory Management VM in One Node deployment)
Get-AzsInfrastructureRoleInstance
The command does the following:
- Lists Infrastructure Role Instances
Does list all Scale Units in a specified Region
Get-AzsScaleUnit
The command does the following:
- Lists Scale Units
Does list all Scale Units Nodes
Get-AzsScaleUnitNode
The command does the following:
- Lists Scale Unit Nodes
Does list all logical Networks by ID
Get-AzsLogicalNetwork
The command does the following:
- Lists logical Networks
Does return the total capacity of the storage subsystem
Get-AzSStorageSubsystem
The command does the following:
- Lists total storage capacity for the storage subsystem
Does list all file shares in the storage subsystem
Get-AzsInfrastructureShare
The command does the following:
- Retrieves all file shares
Does list all IP Pools
Get-AzsIpPool
The command does the following:
- Retrieves all IP Pools
Does list all MAC Address Pool
Get-AzsMacPool
The command does the following:
- Retrieves all MAC Address Pools
Does list all Gateway Pools
Get-AzsGatewayPool
The command does the following:
- Retrieves all Gateway Pools
Does list all SLB MUX Instances
Get-AzsSLBMux
The command does the following:
- Retrieves all SLB MUX instances
Does list all Gateway Instances
Get-AzsGateway
The command does the following:
- Retrieves all Gateway instances
Does start an Infra Role Instance
Start-AzsInfrastructureRoleInstance -Name "InfraRoleInstanceName"
The command does the following:
- Starts an Infra Role instance
Does stop an Infra Role Instance
Stop-AzsInfrastructureRoleInstance -Name "InfraRoleInstanceName"
The command does the following:
- Stops an Infra Role instance
Does Restart an Infra Role Instance
Restart-AzsInfrastructureRoleInstance -Name "InfraRoleInstanceName"
The command does the following:
- Restart an Infra Role instance
Does add an IP Pool
Add-AzsIpPool -Name "PoolName" -StartIPAddress "192.168.55.1" -EndIPAddress "192.168.55.254" -AddressPrefix "192.168.55.0/24"
The command does the following:
- Adds an IP Pool
Does put a ScaleUnitNode in Maintenance Mode
Disable-AzsScaleUnitNode -Name NodeName
The command does the following:
- Enables Maintenance Mode for a specified ScaleUnitNode
Does resume a ScaleUnitNode from Maintenance Mode
Enable-AzsScaleUnitNode -Name NodeName
The command does the following:
- Resume from Maintenance Mode for a specified ScaleUnitNode
Does show capacity for specified Region
Get-AzsLocationCapacity
The command does the following:
- Retrieves Region Capacity information
Does show resource provider healths
Get-AzsResourceProviderHealths
The command does the following:
- List Resource Provider and their Healths status
Does show infrastructure role healths
Get-AzsInfrastructureRoleHealths
The command does the following:
- List Infrastructure Roles and their Healths status
Does show Backup location
Get-AzsBackupLocation
The command does the following:
- List information about the backup location like share path
Does show backups
Get-AzsBackup
The command does the following:
- List backups
Does start a backup job
Start-AzsBackup
The command does the following:
- starts a backup job and does store it at configured share path
Does restore a backup job
Restore-AzsBackup -name ID
The command does the following:
- Restore a specified Backup job
Demonstrates using multiple commands together for an end to end scenario.
#Retrieve all Alerts and apply a filter to only show active Alerts
$Active=Get-AzsAlert | Where {$_.State -eq "active"}
$Active
#Stop Infra Role Instance
Stop-AzsInfrastructureRoleInstance -Name $Active.ResourceName
#Start Infra Role Instance
Start-AzsInfrastructureRoleInstance -Name $Active.resourceName
#Validate if error is resolved (Can take up to 3min)
Get-AzsAlert | Where {$_.State -eq "active"}
#Retrieve all Alerts and apply a filter to only show active Alerts
$Active=Get-AzsAlert | Where {$_.State -eq "active"}
$Active
#Review IP Pool Allocation
Get-AzsIpPool
#Add New Public IP Pool
Add-AzsIpPool -Name "NewPublicIPPool" -StartIPAddress "192.168.80.0" -EndIPAddress "192.168.80.255" -AddressPrefix "192.168.80.0/24"
#Validate new IP Pool
Get-AzsIpPool
#Review Current Region Update Summary
Get-AzsUpdateLocation
#Check for available and applicable updates
Get-AzsUpdate
#Apply Update
Install-AzsUpdate -Update "2.0.0.0"
#Check Update Run
Get-AzsUpdateRun -Update "2.0.0.0"
#Review Region Update Summary after successful run
Get-AzsUpdateLocation
#Review current ScaleUnitNode State
$node=Get-AzsScaleUnitNode
$node | fl
#Enable Maintenance Mode for that node which drains all active resources
Disable-AzsScaleUnitNode -Name $node.name
#Power Off Server using build in KVM or physical power button
#BMC IP Address is returned by previous command $node.properties | fl
#Apply FRU Procedure
#Power On Server using build in KVM or physical power button
#Resume ScaleUnitNode from Maintenance Mode
Enable-AzsScaleUnitNode -Name $node.name
#Validate ScaleUnitNode Status
$node=Get-AzsScaleUnitNode
$node | fl
This command modifies an Azure Stack instance's latitude and longitude location
$EnvironmentName = "AzureStackAdmin"
$directoryName = "<<yourDirectoryName>>.onmicrosoft.com"
$credential = Get-Credential
$latitude = '12.972442'
$longitude = '77.580643'
$regionName = 'local'
Set-AzsLocationInformation -Location $regionName -Latitude $latitude -Longitude $longitude