Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hello @Som Shrivastava
Thank you for reaching out to the Microsoft Q&A platform. My name is Andrew and I am happy to help with your concerne.
I understand you are having an issue with Azure Web App and the corresponding CLI.
Problem summary The CLI error means the App Service name is already present somewhere the service can see, but the CLI cannot retrieve its details in the current subscription/tenant/context. Common causes: the name is taken by a Web App or Function App in another subscription/tenant, a stale/cached view in the CLI, or a permissions/tenant mismatch.
Verified quick checklist and fixes
- Ensure you're using the correct tenant/subscription
- Confirm current account and subscription: az account show -o table
- If wrong, switch to the intended subscription: az account set --subscription <subscription-id-or-name>
- Search all subscriptions for any Microsoft.Web/sites resource with that name
Bash (Linux/macOS / WSL / Git Bash):
NAME=your-webapp-name
for sub in $(az account list --query "[].id" -o tsv); do
az resource show --resource-type Microsoft.Web/sites --name $NAME --subscription $sub -o json && echo "FOUND in $sub" && break || true
done
PowerShell (Windows):
$name = 'your-webapp-name'
az account list --query "[].id" -o tsv | ForEach-Object {
$sub = $_
try {
az resource show --resource-type Microsoft.Web/sites --name $name --subscription $sub -o json | Out-Null
Write-Host "FOUND in subscription: $sub"
break
} catch { }
}
Note: Function Apps, Web Apps and deployment slots share the same Microsoft.Web/sites namespace; the command covers those.
- If you find the resource in another subscription/tenant
- Either delete it (if intended) or use the correct subscription/credential when running the CLI.
- If you don't find any resource
- Clear/local-cached auth and re-authenticate, then re-run with debug to inspect REST errors: az logout az login az webapp create ... --debug
- Also update Azure CLI (fixes some bugs): az upgrade
- If Portal can create the app but CLI still fails
- Compare the REST calls shown by Portal (Activity log) vs CLI --debug output. The mismatch usually reveals a tenant/subscription boundary or permission issue.
When to escalate
- If the commands above don't find the name and re-login/upgrade don't help, open an Azure Support ticket including the --debug CLI output and the subscription/tenant IDs you checked; Microsoft support can inspect backend reservations or soft-deleted hostnames.
Notes
- The hostname space is global for App Service within the public Azure cloud; a name taken in any subscription/tenant in the same cloud prevents creation.
- Searching Microsoft.Web/sites across all subscriptions is the most reliable way to prove whether the name is actually in use.
I hope this helps with your issue and if you find this information to be helpful, please mark this answer as "accepted" and this helps the community find helpful answers. Also please follow me here on Microsoft Learn Q&A.
Best regards,
Andrew Taylor