Some PowerShell examples on how to reach out to Azure WireServer from a VM or VMSS instance to get the ContainerId from Azure platform.
$uri = 'http://168.63.129.16/machine?comp=goalstate'
$headers = @{
"x-ms-guest-agent-name" = "WaAgent-2.5.0.0 (2.7.0.0)"
"x-ms-version" = "2015-04-05"
}
$xml = $null
$xml = Invoke-RestMethod -Uri $uri -Headers $headers
$xml.GoalState.Container.ContainerId$uri = 'http://168.63.129.16/machine?comp=goalstate'
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("x-ms-guest-agent-name", "WaAgent-2.5.0.0 (2.7.0.0)")
$wc.Headers.Add("x-ms-version", "2015-04-05")
$xml = $null
$xml = [xml]$wc.DownloadString($uri)
$xml.GoalState.Container.ContainerId$objXmlHttp = New-Object -ComObject MSXML2.ServerXMLHTTP
$uri = 'http://168.63.129.16/machine?comp=goalstate'
$objXmlHttp.Open("GET", $uri, $false)
$objXmlHttp.setRequestHeader("x-ms-guest-agent-name", "WaAgent-2.5.0.0 (2.7.0.0)")
$objXmlHttp.setRequestHeader("x-ms-version", "2015-04-05")
$objXmlHttp.Send()
$xml = $null
$xml = [xml]$objXmlHttp.responseText
$xml.GoalState.Container.ContainerId... ServerXMLHTTP object depends on WinHTTP proxy settings ...
