In this exercise, you establish a PowerShell Remoting session to the privileged endpoint and run Windows PowerShell cmdlets accessible via the Remoting session. The exercise consists of the following tasks:
- Create a log share
- Connect to the privileged endpoint
- Manage Azure Stack Admin Cloud accounts via the privileged endpoint.
- Manage Azure Stack diagnostics log collection via the privileged endpoint.
- Open an RDP session to the AzS-HOST machine by launching the RDP client (mstsc.exe) and connecting with the following parameters: Computer: azs-host.azurestack.local Username: AzureStackAdmin Password: Pa55w.rd
- From the RDP session to AzS-HOST, start File Explorer.
- In File Explorer, create a new folder C:\Logs.
- Right-click Logs and, in the right-click menu, click Properties.
- In the Logs Properties window, click the Sharing tab and then click Advanced Sharing.
- In the Advanced Sharing dialog box, click Share this folder and then click Permissions.
- In the Permissions for Logs window, ensure that the Everyone entry is selected and then click Remove.
- Click Add, in the Select Users, Computers, Service Accounts, or Groups dialog box, type AzureStackAdmin and click OK.
- Ensure that the AzureStackAdmin entry is selected and click the Full Control checkbox in the Allow column.
- Click OK.
- Back in the Advanced Sharing dialog box, click OK.
- Back in the Logs Properties window, click Close.
- Open an RDP session to the AzS-HOST machine by launching the RDP client (mstsc.exe) and connecting with the following parameters: Computer: azs-host.azurestack.local Username: AzureStackAdmin Password: Pa55w.rd
- From the RDP session to AzS-HOST, start Windows PowerShell ISE as administrator.
- From the Administrator: Windows PowerShell ISE window, run the following to identify the IP address of the infrastructure VM running the privileged endpoint:
$ipAddress = (Resolve-DnsName –Name AzS-ERCS01).IPAddress From the Administrator: Windows PowerShell ISE window, run the following to add the IP address of the infrastructure VM running the privileged endpoint to the list of WinRM trusted hosts (unless all hosts are already allowed): $trustedHosts = (Get-Item –Path WSMan:\localhost\Client\TrustedHosts).Value If ($trustedHosts –ne ‘*’) { If ($trustedHosts –ne ‘’) { $trustedHosts += “,ipAddress” } else { $trustedHosts = “$ipAddress” } } Set-Item WSMan:\localhost\Client\TrustedHosts –Value $TrustedHosts -Force
- From the Administrator: Windows PowerShell ISE window, run the following to store the Azure Stack admin credentials in a variable:
$adminUserName = ‘AzureStackAdmin@azurestack.local’ $adminPassword = ‘Pa55w.rd’ | ConvertTo-SecureString –Force –AsPlainText $adminCredentials = New-Object PSCredential($adminUserName,$adminPassword)
- From the Administrator: Windows PowerShell ISE window, run the following to establish a PowerShell Remoting session to the privileged endpoint:
Enter-PSSession –ComputerName $ipAddress –ConfigurationName –PrivilegedEndpoint –Credential $adminCredentials
Verify that the PowerShell Remoting session has been successfully established. The console pane in the Windows PowerShell ISE window should be displaying the prompt starting with the name of the infrastructure VM running the privileged endpoint enclosed in square brackets ([AzS-ERCS01]).
- From the PowerShell Remoting session in the Administrator: Windows PowerShell ISE window, in the console pane, run the following to identify all available PowerShell cmdlets:
Get-Command
- From the PowerShell Remoting session, run the following to identify current Cloud Admin user accounts:
Get-CloudAdminUserList
The list should include only two accounts – your AzureStackAdmin account and the CloudAdmin account.
- From the PowerShell Remoting session, run the following to change the password of the CloudAdmin account
Set-CloudAdminUserPassword –UserName CloudAdmin
When prompted, in the Windows PowerShell ISE – Input dialog box, in the Current password text box, type Pa55w.rd and click OK. When prompted, in the Windows PowerShell ISE – Input dialog box, in the New password text box, type Pa55w.rd1234 and click OK. When prompted, in the Windows PowerShell ISE – Input dialog box, in the Repeat password text box, type Pa55w.rd1234 and click OK.
- From the PowerShell Remoting session in the Administrator: Windows PowerShell ISE window, in the console pane, run the following to collect Azure Stack storage logs:
Get-AzureStackLog –OutputSharePath ‘\AzS-Host\Logs’ –OutputShareCredential $using:adminCredentials –FilterByRole Storage
You have the option of filtering by role as well as specify the time window for which logs should be collected. For details, refer to https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-diagnostics
Wait until the cmdlet completes and, in File Explorer, review the content of the C:\Logs folder From the PowerShell Remoting session, run the following to exit the session:
Exit-PSSession