Created
December 12, 2016 04:43
-
-
Save Pyromaniaxxx/b7d4970a284960418e17a26c4f7d9ff3 to your computer and use it in GitHub Desktop.
Connect-MASTP2.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pass = "<<password>>" | |
$AAD = "xxxx.onmicrosoft.com" | |
$HostIP = "10.10.10.xx" | |
New-Item -Path "c:\work" -ItemType Directory -Force | Out-Null | |
Set-Location "C:\work" | |
Install-Module -Name AzureRm -RequiredVersion 1.2.6 -Scope CurrentUser | |
Invoke-WebRequest -Uri https://github.com/Azure/AzureStack-Tools/archive/master.zip -OutFile master.zip | |
Expand-Archive -Path ./master.zip -DestinationPath c:\work -Force | |
Set-Location .\AzureStack-Tools-master\Connect | |
Import-Module .\AzureStack.Connect.psm1 | |
$Password = ConvertTo-SecureString $pass -AsPlainText -Force | |
Set-Item wsman:\localhost\Client\TrustedHosts -Value $HostIP -Concatenate | |
Set-Item wsman:\localhost\Client\TrustedHosts -Value mas-ca01.azurestack.local -Concatenate | |
$natIp = Get-AzureStackNatServerAddress -HostComputer $HostIP -Password $Password | |
# Create VPN connection entry for the current user | |
Add-AzureStackVpnConnection -ServerAddress $natIp -Password $Password | |
# Connect to the Azure Stack instance. This command can be used multiple times. | |
Connect-AzureStackVpn -Password $Password | |
Add-AzureStackAzureRmEnvironment -AadTenant $AAD | |
$AadTenant = Get-AzureStackAadTenant -HostComputer $HostIP -Password $Password | |
Add-AzureStackAzureRmEnvironment -AadTenant $AAD | |
Add-AzureRmAccount -EnvironmentName AzureStack -TenantId $AAD | |
Register-AllAzureRmProviders | |
Register-AllAzureRmProvidersOnAllSubscriptions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment