Proxy Settings when using OMS Agent VM Extension via ARM template

Copper Contributor

Hi all

 

I'm adding the Monitoring Agent using a VM extension in an ARM template, using the following code. My question is whether it's possible to specify authentication details in the template code so that the agent can authenticate to the proxy server. Is this possible?

 

"properties": {
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "MicrosoftMonitoringAgent",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"workspaceId": "[parameters('omsworkspaceid')]",
"proxyUri": "proxy:8080"
},

 

 

5 Replies

 

Hi,

Adding the OMS  agent generally we use this like below. 

{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'),'/','MMAAgent')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"properties": {
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "MicrosoftMonitoringAgent",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"workspaceId": "[reference(resourceId(parameters('OMSResourceGroupName'),'Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').customerId]"
},
"protectedSettings": {
"workspaceKey": "[listKeys(resourceId(parameters('OMSResourceGroupName'),'Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').primarySharedKey]"
}
}
}

 

Adding the proxyUri to the settings. I think that should work.

{
"type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(parameters('vmName'),'/','MMAAgent')]", "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "properties": { "publisher": "Microsoft.EnterpriseCloud.Monitoring", "type": "MicrosoftMonitoringAgent", "typeHandlerVersion": "1.0", "autoUpgradeMinorVersion": true, "settings": { "workspaceId": "[reference(resourceId(parameters('OMSResourceGroupName'),'Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').customerId]", "proxyUri": "[parameters('ProxyUri')]" }, "protectedSettings": { "workspaceKey": "[listKeys(resourceId(parameters('OMSResourceGroupName'),'Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').primarySharedKey]" } } }

 

Thank you for the reply. I'm able to configure the proxy address using this method, however my question is how I can use proxy credentials, in order to authenticate to the proxy. 

To configure proxy settings for the Microsoft Monitoring Agent using Control Panel

Open Control Panel.

Open Microsoft Monitoring Agent.

Click the Proxy Settings tab.
proxy settings tab

Select Use a proxy server and type the URL and port number, if one is needed, similar to the example shown. If your proxy server requires authentication, type the username and password to access the proxy server.

Use the following procedure to create a PowerShell script that you can run to set the proxy settings for each agent that connects directly to servers.

To configure proxy settings for the Microsoft Monitoring Agent using a script
Copy the following sample, update it with information specific to your environment, save it with a PS1 file name extension, and then run the script on each computer that connects directly to the OMS service.


param($ProxyDomainName="http://proxy.contoso.com:80", $cred=(Get-Credential))

# First we get the Health Service configuration object. We need to determine if we
# have the right update rollup with the API we need. If not, no need to run the rest of the script.
$healthServiceSettings = New-Object -ComObject 'AgentConfigManager.MgmtSvcCfg'

$proxyMethod = $healthServiceSettings | Get-Member -Name 'SetProxyInfo'

if (!$proxyMethod)
{
Write-Output 'Health Service proxy API not present, will not update settings.'
return
}

Write-Output "Clearing proxy settings."
$healthServiceSettings.SetProxyInfo('', '', '')

$ProxyUserName = $cred.username

Write-Output "Setting proxy to $ProxyDomainName with proxy username $ProxyUserName."
$healthServiceSettings.SetProxyInfo($ProxyDomainName, $ProxyUserName, $cred.GetNetworkCredential().password)

@Vinoth_Azure It's really cool to get the proxyUri settings in ARM. It works for me on Windows but when I try it with linux version (type = "OmsAgentForLinux") it always fail with this error. Do you know if this parameter is supported on Linux version of the Microsoft.EnterpriseCloud.Monitoring extension?

"code": "VMExtensionProvisioningError",
"message": "VM has reported a failure when processing extension 'LogAnalytics-Agent-Extension'. Error message:
\"Enable failed with exit code 53 Installation failed due to incorrect workspace key. Please check if the workspace
key is correct. For details, check logs in
/var/log/azure/Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux/extension.log\"\r\n\r\nMore information on
troubleshooting is available at https://aka.ms/VMExtensionOMSAgentLinuxTroubleshoot "

@Steeve_Roy I'm still getting the same error , any work around for linux vm