Der Azure Monitor-Agent unterstützt Verbindungen mithilfe von direkten Proxys, einem Log Analytics-Gateway und privaten Verbindungen. In diesem Artikel wird erläutert, wie Sie Netzwerkeinstellungen definieren und die Netzwerkisolation für den Azure Monitor-Agent aktivieren.
In der folgenden Tabelle sind die Endpunkte aufgeführt, die Firewalls für unterschiedliche Clouds zulassen müssen. Jeder Endpunkt ist eine ausgehende Verbindung mit Port 443.
Ersetzen Sie das Endpunktsuffix durch das Suffix in der folgenden Tabelle für jede Cloud:
Die Azure Monitor Agent-Erweiterungen für Windows und Linux können mithilfe des HTTPS-Protokolls entweder über einen Proxyserver oder ein Log Analytics-Gateway mit Azure Monitor kommunizieren. Verwenden Sie die Erweiterungen für Azure VMs, Skalierungssätze und Azure Arc für Server, die wie in den folgenden Schritten konfiguriert sind. Sowohl die anonyme Authentifizierung als auch die Standardauthentifizierung mithilfe eines Benutzernamens und eines Kennworts wird unterstützt.
Verwenden Sie die Befehle in den folgenden Beispielen basierend auf Ihrer Umgebung und Konfiguration.
Kein Proxy
$settingsString = '{"proxy":{"mode":"none"}}';
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Proxy ohne Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth": "false"}}';
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Proxy mit Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth": "true"}}';
$protectedSettingsString = '{"proxy":{"username":"[username]","password": "[password]"}}';
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString -ProtectedSettingString $protectedSettingsString
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
Um die Proxykonfiguration standardmäßig wiederherzustellen, definieren Sie $settingsString = '{}'; wie im folgenden Beispiel:
$settingsString = '{}';
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Kein Proxy
$settingsString = '{"proxy":{"mode":"none"}}';
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Proxy ohne Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth": "false"}}';
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Proxy mit Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth": "true"}}';
$protectedSettingsString = '{"proxy":{"username":"[username]","password": "[password]"}}';
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString -ProtectedSettingString $protectedSettingsString
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
Um die Proxykonfiguration standardmäßig wiederherzustellen, definieren Sie $settingsString = '{}'; wie im folgenden Beispiel:
$settingsString = '{}';
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -SettingString $settingsString
Verwenden Sie Azure PowerShell, um Proxyeinstellungen für eine Skalierungsgruppe für virtuelle Windows-Computer zu konfigurieren.
Kein Proxy
$settingsString = '{"proxy":{"mode":"none"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Proxy ohne Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"false"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Proxy mit Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"true"}}';
$protectedSettingsString = '{"proxy":{"username":"[username]","password":"[password]"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Setting $settingsString -ProtectedSetting $protectedSettingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
$settingsString = '{}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Hinweis
Wenn Sie ihre Skalierungssatz-Upgraderichtlinie auf "Manuell" festlegen, müssen Sie vorhandene Instanzen aktualisieren, indem Sie "Update-AzVmssInstance " ausführen, nachdem Sie das VMSS-Modell geändert haben. Bei Skalierungssätzen mit der Richtlinie für automatische oder rollierende Upgrades wird die Erweiterung automatisch auf Instanzen angewendet.
Verwenden Sie Azure PowerShell, um Proxyeinstellungen für einen Skalierungssatz für virtuelle Linux-Computer zu konfigurieren.
Kein Proxy
$settingsString = '{"proxy":{"mode":"none"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Proxy ohne Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"false"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Proxy mit Authentifizierung
$settingsString = '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"true"}}';
$protectedSettingsString = '{"proxy":{"username":"[username]","password":"[password]"}}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Setting $settingsString -ProtectedSetting $protectedSettingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
$settingsString = '{}';
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Setting $settingsString
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Hinweis
Wenn Sie ihre Skalierungssatz-Upgraderichtlinie auf "Manuell" festlegen, müssen Sie vorhandene Instanzen aktualisieren, indem Sie "Update-AzVmssInstance " ausführen, nachdem Sie das VMSS-Modell geändert haben. Bei Skalierungssätzen mit der Richtlinie für automatische oder rollierende Upgrades wird die Erweiterung automatisch auf Instanzen angewendet.
Verwenden Sie die Azure CLI, um Proxyeinstellungen für eine Windows-VM-Skalierungsgruppe zu konfigurieren.
Kein Proxy
az vmss extension set \
--name AzureMonitorWindowsAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"none"}}'
Proxy ohne Authentifizierung
az vmss extension set \
--name AzureMonitorWindowsAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"false"}}'
Proxy mit Authentifizierung
az vmss extension set \
--name AzureMonitorWindowsAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"true"}}' \
--protected-settings '{"proxy":{"username":"[username]","password":"[password]"}}'
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
az vmss extension set \
--name AzureMonitorWindowsAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{}'
Hinweis
Wenn Sie Ihre Skalierungssatz-Upgraderichtlinie auf "Manuell" festlegen, müssen Sie vorhandene Instanzen aktualisieren, indem Sie az vmss update-instances ausführen, um die Erweiterung anzuwenden. Bei Skalierungssätzen mit der Richtlinie für automatische oder rollierende Upgrades wird die Erweiterung automatisch auf Instanzen angewendet.
Verwenden Sie Azure CLI, um Proxyeinstellungen in einem Skalierungssatz für virtuelle Linux-Computer zu konfigurieren.
Kein Proxy
az vmss extension set \
--name AzureMonitorLinuxAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"none"}}'
Proxy ohne Authentifizierung
az vmss extension set \
--name AzureMonitorLinuxAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"false"}}'
Proxy mit Authentifizierung
az vmss extension set \
--name AzureMonitorLinuxAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{"proxy":{"mode":"application","address":"http://[address]:[port]","auth":"true"}}' \
--protected-settings '{"proxy":{"username":"[username]","password":"[password]"}}'
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
az vmss extension set \
--name AzureMonitorLinuxAgent \
--publisher Microsoft.Azure.Monitor \
--vmss-name <vmss-name> \
--resource-group <resource-group-name> \
--settings '{}'
Hinweis
Wenn Sie Ihre Skalierungssatz-Upgraderichtlinie auf "Manuell" festlegen, müssen Sie vorhandene Instanzen aktualisieren, indem Sie az vmss update-instances ausführen, um die Erweiterung anzuwenden. Bei Skalierungssätzen mit der Richtlinie für automatische oder rollierende Upgrades wird die Erweiterung automatisch auf Instanzen angewendet.
Kein Proxy
$settings = @{"proxy" = @{mode = "none"}}
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
Proxy ohne Authentifizierung
$settings = @{"proxy" = @{mode = "application"; address = "http://[address]:[port]"; auth = "false"}}
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
Proxy mit Authentifizierung
$settings = @{"proxy" = @{mode = "application"; address = "http://[address]:[port]"; auth = "true"}}
$protectedSettings = @{"proxy" = @{username = "[username]"; password = "[password]"}}
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings -ProtectedSetting $protectedSettings
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
Um die Proxykonfiguration standardmäßig wiederherzustellen, definieren Sie $settings = @{}; wie im folgenden Beispiel:
$settings = @{}
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
Kein Proxy
$settings = @{"proxy" = @{mode = "none"}}
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
Proxy ohne Authentifizierung
$settings = @{"proxy" = @{mode = "application"; address = "http://[address]:[port]"; auth = "false"}}
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
Proxy mit Authentifizierung
$settings = @{"proxy" = @{mode = "application"; address = "http://[address]:[port]"; auth = "true"}}
$protectedSettings = @{"proxy" = @{username = "[username]"; password = "[password]"}}
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings -ProtectedSetting $protectedSettings
Zurücksetzen der Proxykonfiguration auf Standardeinstellungen
Um die Proxykonfiguration standardmäßig wiederherzustellen, definieren Sie $settings = @{}; wie im folgenden Beispiel:
$settings = @{}
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -Setting $settings
{
"properties": {
"displayName": "Configure Windows Arc-enabled machines to run the Azure Monitor Agent",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Automate the deployment of the Azure Monitor Agent extension on your Windows Arc-enabled machines for collecting telemetry data from the guest OS. This policy installs the extension if the OS and region are supported and system-assigned managed identity is enabled, and skips install otherwise. Learn more at https://aka.ms/AMAOverview.",
"metadata": {
"version": "2.3.0",
"category": "Monitoring"
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy."
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/osName",
"equals": "Windows"
},
{
"field": "location",
"in": [
"australiacentral",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"eastasia",
"eastus",
"eastus2",
"eastus2euap",
"francecentral",
"germanywestcentral",
"japaneast",
"japanwest",
"jioindiawest",
"koreacentral",
"koreasouth",
"northcentralus",
"northeurope",
"norwayeast",
"southafricanorth",
"southcentralus",
"southeastasia",
"southindia",
"swedencentral",
"switzerlandnorth",
"uaenorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westindia",
"westus",
"westus2",
"westus3"
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.HybridCompute/machines/extensions",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/cd570a14-e51a-42ad-bac8-bafd67325302"
],
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "AzureMonitorWindowsAgent"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.Azure.Monitor"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
"equals": "Succeeded"
}
]
},
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
}
},
"variables": {
"extensionName": "AzureMonitorWindowsAgent",
"extensionPublisher": "Microsoft.Azure.Monitor",
"extensionType": "AzureMonitorWindowsAgent"
},
"resources": [
{
"name": "[concat(parameters('vmName'), '/', variables('extensionName'))]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2021-05-20",
"properties": {
"publisher": "[variables('extensionPublisher')]",
"type": "[variables('extensionType')]",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"proxy": {
"auth": "false",
"mode": "application",
"address": "http://XXX.XXX.XXX.XXX"
}
},
"protectedsettings": { }
}
}
]
},
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
}
}
}
}
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/94f686d6-9a24-4e19-91f1-de937dc171a4",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "94f686d6-9a24-4e19-91f1-de937dc171a4"
}