[System.String]$strUsername = "service-account-name";
[System.String]$strHostFQDN = "orchestrator.cloudbuildtools.com";
[System.String]$strAccessTokenUri = "https://$strHostFQDN/csp/gateway/am/api/login?access_token";
[System.Collections.Hashtable]$objHashtable = @{'username' = $strUsername; 'password' = $password };
[System.Management.Automation.PSObject]$objPSObjectRequest = New-Object -TypeName PSObject -Property $objHashtable;
[System.String]$strJson = ConvertTo-Json -InputObject $objPSObjectRequest -Compress;
[System.Management.Automation.PSObject]$objPSObjectReturn = Invoke-RestMethod $strAccessTokenUri -Method Post -ContentType "application/json" -Body $strJson -SkipCertificateCheck -SkipHeaderValidation;
[System.String]$strRefreshToken = $objPSObjectReturn.refresh_tokenDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
