Use this to move log ingestion and queries onto private endpoints. The main risk is not the private endpoint but DNS: the first one you create changes name resolution for shared Azure Monitor endpoints on every network using those private DNS zones. Teams who were never told can lose Application Insights data or workspace queries.
Know the blast radius first
| Traffic | Endpoint type | Effect of linking one resource |
|---|---|---|
| Log Analytics workspace ingestion | Per workspace | Only that workspace resolves privately |
| Data collection endpoint (DCE) | Per DCE | Only that DCE resolves privately |
| Log Analytics query | Shared | Queries to all workspaces use the private path |
| Application Insights ingestion | Shared (global and regional) | All components on that DNS use the private path |
Three design rules follow:
- One AMPLS per DNS boundary. If two AMPLS endpoints write to the same private DNS zones, the last write wins and the other scope's resources break.
- Hub and spoke: one AMPLS with one private endpoint in the hub, reachable from all spokes.
- Isolated networks with separate DNS can each have their own AMPLS and endpoint. That is the way to separate production from a sandbox that needs different access modes.
Phase 1: inventory
- List existing scopes and what they contain. An unexpected scope is a stop condition.
az resource list --resource-type microsoft.insights/privateLinkScopes \
--query "[].{name:name, rg:resourceGroup}" -o table
az monitor private-link-scope scoped-resource list -g rg-mon --scope-name ampls-hub -o table
- Find every workspace, component and DCE that the networks use, across subscriptions:
az graph query --first 1000 -q "
resources
| where type in~ ('microsoft.operationalinsights/workspaces',
'microsoft.insights/components',
'microsoft.insights/datacollectionendpoints')
| project type, name, subscriptionId, location,
ingest = tostring(properties.publicNetworkAccessForIngestion),
query = tostring(properties.publicNetworkAccessForQuery),
dce = tostring(properties.networkAcls.publicNetworkAccess)" -o table
- Find who already links the zones. Every linked VNet, and every on-premises forwarder that uses it, is in scope:
for Z in privatelink.monitor.azure.com privatelink.oms.opinsights.azure.com \
privatelink.ods.opinsights.azure.com privatelink.agentsvc.azure-automation.net \
privatelink.blob.core.windows.net; do
echo "== $Z"
az network private-dns link vnet list -g rg-dns -z $Z \
--query "[].{link:name, vnet:virtualNetwork.id}" -o tsv
done
- Identify anything that depends on public queries: Grafana, SaaS tools, pipelines, analysts on home networks.
- Check subnet space. The endpoint uses many IPs and more per DCE and workspace, so a /27 is a floor. Give it room.
- Check current scope limits for linked resources and endpoints.
Warning
The blob zone is shared with every other storage private endpoint in your estate. Reuse the central
privatelink.blob.core.windows.netzone. Creating a second one and linking it to the VNet makes storage private endpoints fail to resolve.
Phase 2: build in Open mode
- Create the scope and immediately set both modes to
Open. Open uses the private path for linked resources and still allows public resources.
SUB=$(az account show --query id -o tsv)
AMPLS_ID=/subscriptions/$SUB/resourceGroups/rg-mon/providers/microsoft.insights/privateLinkScopes/ampls-hub
az rest --method put \
--url "https://management.azure.com$AMPLS_ID?api-version=2021-07-01-preview" \
--body '{"location":"global","properties":{"accessModeSettings":{"queryAccessMode":"Open","ingestionAccessMode":"Open"}}}'
A newer API version may be available; check the reference for your cloud.
- Add all workspaces, components and DCEs before creating the endpoint:
az monitor private-link-scope scoped-resource create -g rg-mon \
--scope-name ampls-hub -n law-prod --linked-resource $LAW_ID
az monitor private-link-scope scoped-resource create -g rg-mon \
--scope-name ampls-hub -n appi-prod --linked-resource $APPI_ID
az monitor private-link-scope scoped-resource create -g rg-mon \
--scope-name ampls-hub -n dce-prod --linked-resource $DCE_ID
For workspace-based Application Insights, link both the component and its workspace.
- Give each Azure Monitor Agent machine a DCE for configuration access. Without it, agents on a closed network cannot fetch their rules:
az monitor data-collection rule association create \
--name configurationAccessEndpoint \
--resource $VM_ID --data-collection-endpoint-id $DCE_ID
The association name must be exactly configurationAccessEndpoint. The DCE needs to be in a region suitable for the machine; check the current regional rules. Keep the existing DCR association. This one is additional.
- Lower DNS TTLs and tell all teams in scope the change time.
Phase 3: create the endpoint
- Create it and attach the DNS zones in one change window:
az network private-endpoint create -g rg-mon -n pe-ampls-hub \
--vnet-name vnet-hub --subnet snet-pe \
--private-connection-resource-id $AMPLS_ID \
--group-id azuremonitor --connection-name ampls-hub
DNS=/subscriptions/$SUB/resourceGroups/rg-dns/providers/Microsoft.Network/privateDnsZones
az network private-endpoint dns-zone-group create -g rg-mon \
--endpoint-name pe-ampls-hub -n default \
--zone-name monitor --private-dns-zone $DNS/privatelink.monitor.azure.com
for Z in oms.opinsights.azure.com ods.opinsights.azure.com \
agentsvc.azure-automation.net blob.core.windows.net; do
az network private-endpoint dns-zone-group add -g rg-mon \
--endpoint-name pe-ampls-hub -n default \
--zone-name ${Z%%.*} --private-dns-zone $DNS/privatelink.$Z
done
- Allow TCP 443 from all client networks to the endpoint subnet, in NSGs and firewalls.
- On custom DNS servers, forward the public zone names (for example
monitor.azure.com,ods.opinsights.azure.com) toward a resolver that ends at 168.63.129.16. Do not forward only theprivatelinknames.
Phase 4: verify from each network
- Resolve from a spoke and from on-premises. All must return private addresses:
WID=$(az monitor log-analytics workspace show -g rg-mon -n law-prod --query customerId -o tsv)
for H in $WID.ods.opinsights.azure.com $WID.oms.opinsights.azure.com api.monitor.azure.com; do
echo "$H -> $(dig +short $H | tail -1)"
done
curl -sS -o /dev/null -w "%{remote_ip} %{http_code}\n" https://api.monitor.azure.com
An HTTP error code is fine here. A private remote_ip and a completed TLS handshake are what you need.
- Compare the fleet before and after. Machines that went quiet need attention:
let before = Heartbeat | where TimeGenerated between (ago(3h) .. ago(2h)) | distinct Computer;
let after = Heartbeat | where TimeGenerated > ago(20m) | distinct Computer;
before | join kind=leftanti after on Computer
Change the windows so before falls ahead of your cutover.
- Compare Application Insights request volume per role as well. A silent drop is the typical symptom of a component left out of scope.
- Open the portal from a private client and run a query. Some Chromium-based browsers restrict public sites from calling private addresses, which looks like a network failure.
| Failure | Cause | Fix |
|---|---|---|
| NXDOMAIN for a workspace ODS name | Workspace not in scope, zone has no record | Add it to AMPLS |
| Private IP, connection timeout | NSG, firewall or route | Permit 443 to the endpoint |
| Heartbeat stops on one spoke | Wrong DNS or no configuration DCE | Fix forwarding or association |
| Another team's telemetry gone | Shared endpoint with PrivateOnly | Return to Open, add their component |
Phase 5: tighten
- Wait at least one full business cycle in Open mode.
- Switch query mode, then ingestion mode, to
PrivateOnlyin separate changes. The setting affects every network sharing the DNS. For an exception, use a per-endpoint exclusion in Access modes on the scope. - Close the resources themselves. This is separate from the scope's access modes:
az monitor log-analytics workspace update -g rg-mon -n law-prod \
--ingestion-access Disabled --query-access Enabled
# later, once all analysts use a private path
az monitor log-analytics workspace update -g rg-mon -n law-prod --query-access Disabled
Caution
Disabling public ingestion drops data from every agent not on the private path, including branch servers and other clouds. Data rejected long enough to exhaust the agent's local cache is lost.
- Remember what access modes do not cover: workspace log ingestion uses resource-specific endpoints and does not follow them. To limit exfiltration to other workspaces, block the public endpoints on the egress firewall.
- Accept the exceptions. Diagnostic settings use a Microsoft channel and continue. Queries through Azure Resource Manager cannot use AMPLS and need public query access, which affects some connectors and insights. Managed Prometheus queries need a separate managed private endpoint for the Azure Monitor workspace.
Rollback
- Set both modes to
Openwith the sameaz restcall, and re-enable public access on the resources. - If resolution is the problem, unlink the affected VNet from the
privatelinkzones for Azure Monitor. Leave the blob zone linked. Clear DNS caches and restart agents that hold old addresses.
Prevent it next time
- Deny creation of
microsoft.insights/privateLinkScopesoutside the platform subscription with Azure Policy. - Add new workspaces, components and DCEs to the scope in the same template that creates them.
- Alert from a workspace outside the change on heartbeat loss, so a bad rollout cannot hide its own evidence.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get