Skip to content

Instantly share code, notes, and snippets.

@michaelkuty
Created September 4, 2016 17:49
Show Gist options
  • Save michaelkuty/d3b6ca66db852ffd76f1787b7487105a to your computer and use it in GitHub Desktop.
Save michaelkuty/d3b6ca66db852ffd76f1787b7487105a to your computer and use it in GitHub Desktop.
### Defining a variable for the admin API using the name of my management server and the default admin API port, which is 30004
$AdminURI = "https://localhost:30004"
### Defining a variable for the Admin Authentication Site in my environment. Default port is 300072 but is changed in this environment to use 443
$AuthSite = "https://localhost:30072"
### Defining a variable for the Client Realm, using the default value
$ClientRealm = "http://azureservices/AdminSite"
### Defining a variable for the MGMTSVCToken
$secpasswd = ConvertTo-SecureString “password” -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (“domain\username”, $secpasswd)
$token = Get-MgmtSvcToken -Type Windows -AuthenticationSite $AuthSite -ClientRealm $ClientRealm -DisableCertificateValidation -User $mycreds
echo $token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment