A team deletes an App Service app, Traffic Manager profile, Front Door endpoint, storage account or public IP and leaves the CNAME or A record in place. An attacker creates a resource with the same Azure hostname in their own subscription, and your subdomain then serves their content, collects cookies sent to it, and gets a valid TLS certificate. Save what the name serves now, then delete or repoint the record.
Look here
Log
Search for
Azure DNS record sets
CNAME targets on Azure hostnames that may no longer exist. Flag targets ending in azurewebsites.net, trafficmanager.net, azurefd.net, azureedge.net, blob.core.windows.net, web.core.windows.net, cloudapp.azure.com and cloudapp.net: az network dns record-set cname list --resource-group <rg> --zone-name <zone> --query "[].{name:fqdn, target:CNAMERecord.cname}" -o table
A records
Plain A records that still point at a released address. An alias record shows targetResource.id and empties itself when the resource is deleted, and a plain A record keeps the old address: az network dns record-set a list --resource-group <rg> --zone-name <zone>
Azure Resource Graph
The Azure hostnames you still own. Any CNAME target missing from this list is dangling: az graph query -q "resources | where type in~ ('microsoft.web/sites', 'microsoft.network/trafficmanagerprofiles', 'microsoft.network/publicipaddresses') | project type, name, fqdn=coalesce(tostring(properties.defaultHostName), tostring(properties.dnsConfig.fqdn), tostring(properties.dnsSettings.fqdn))"
Azure Resource Graph, DNS
Record sets across subscriptions, in the dnsresources table with the type microsoft.network/dnszones/cname
AzureActivity, deletes
When the target was deleted and by whom: AzureActivity | where OperationNameValue in~ ("Microsoft.Web/sites/Delete", "Microsoft.Network/trafficManagerProfiles/delete", "Microsoft.Network/frontDoors/delete", "Microsoft.Cdn/profiles/afdendpoints/delete", "Microsoft.Storage/storageAccounts/delete", "Microsoft.Network/publicIPAddresses/delete") | project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, _ResourceId
AzureActivity, records
Record changes in your zones: Microsoft.Network/dnszones/CNAME/write and Microsoft.Network/dnszones/TXT/delete
SecurityAlert
The Defender for App Service dangling DNS alert, raised when an App Service site is deleted and its custom domain still points at it. It does not scan records that already dangled before the plan was on
Public resolution
Content, a certificate issuer or a hostname you do not recognize when you resolve the name from outside and fetch the page. Any of these means the takeover has happened
Contain
#
Item
1
Save the record set, the resolved address, the page content and the served certificate as evidence before any change: az network dns record-set cname show --resource-group <rg> --zone-name <zone> --name <label>
2
Delete the dangling CNAME destructive: az network dns record-set cname delete --resource-group <rg> --zone-name <zone> --name <label> --yes
3
Delete a dangling A record destructive: az network dns record-set a delete --resource-group <rg> --zone-name <zone> --name <label> --yes
4
Where the name must keep working, recreate the resource under your own subscription with the same hostname if the name is still free, then point the record at it
5
Tell users and partners to distrust content served from the name during the exposure window, and check whether sessions or OAuth redirects sent tokens to it
6
Remove the subdomain from app registration redirect URIs, cross-origin resource sharing (CORS) allow lists and cookie domains until you control it again
Eradicate and recover
#
Item
1
Run Microsoft's Get-DanglingDnsRecords PowerShell tool with Reader on all subscriptions to sweep every zone, including CNAMEs kept at other DNS providers
2
Get the app's verification ID for every App Service custom domain: az webapp show --name <app> --resource-group <rg> --query customDomainVerificationId
3
Add an asuid.<subdomain> TXT record with that verification ID for each custom domain
4
Use alias records for public IPs, Traffic Manager profiles, Front Door and CDN endpoints, so the record empties when the resource is deleted
5
Create new web, function and logic apps with secure unique default hostnames. The portal does this by default, and the CLI needs the scope set on every create: az webapp create --name <app> --resource-group <rg> --plan <plan> --domain-name-scope TenantReuse
6
Add CanNotDelete locks to resources that carry a custom domain, and put DNS removal on the decommission checklist
7
Enable Defender for App Service for dangling DNS alerts on future deletions
Watch out
The takeover happens in the attacker's subscription. Your logs show only your own deletion and never the attacker's resource creation.
After an App Service app or a classic cloud service is deleted, Azure reserves its default hostname for subscriptions in the same tenant for a period. Recreate the resource inside that window to reclaim the name, or delete the record.
Secure unique default hostnames apply only at creation. Existing apps keep the guessable <app>.azurewebsites.net name until you clone them, or restore them from backup, into new apps.
Microsoft Learn: prevent dangling DNS entries and avoid subdomain takeover, prevent subdomain takeovers in Azure App Service (secure unique default hostnames), Azure DNS alias records, map a custom domain to App Service, static website hosting, Resource Graph supported tables, resource provider operations, Azure CLI reference for az network dns, az graph and az webapp. Checked October 2026. Defender for App Service introduction: checked September 2026.