Azure DNS Zones REST API Returning Bad Request Error

Lakshmipathi Kakarla 1 Reputation point

Hello team,

Please review below issue and provide input to resolve the same.

I tried to list Azure DNS Zones available in a subscription using REST API as mentioned below{subscriptionId}/providers/Microsoft.Network/dnszones?api-version=2018-05-01

Returned Error:
Bad Request({"code":"BadRequest","message":"The specified subscription {subscriptionId} does not exist"})

I provided valid subscription id.

OS version: Ubuntu 18.04

Azure CLI Version:

$ az version

      "azure-cli": "2.18.0",
      "azure-cli-core": "2.18.0",
      "azure-cli-telemetry": "1.0.6",
      "extensions": {
        "account": "0.2.1",
        "resource-graph": "1.1.0"
Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
603 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JamesTran-MSFT 36,476 Reputation points Microsoft Employee

    @Lakshmipathi Kakarla
    Thank you for your detailed post!

    I tested this out within my lab environment and was able to successfully call the REST API. When it comes to your specific error message, can you make sure that you're using the correct SubscriptionID.

    Error Message:
    Bad Request({"code":"BadRequest","message":"The specified subscription {subscriptionId} does not exist"})

    Next Steps:
    Confirm you're using the correct SubscriptionID

    • Navigate to your Azure Portal -> Navigate to Cost Management + Billing -> Subscriptions -> Copy the SubscriptionID you're trying to use.

    Once you have the correct SubscriptionID, you can try re-running the REST API call:



    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.


    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    1 person found this answer helpful.

  2. Erik van Noorden 6 Reputation points

    i got the same error.
    turns out the 'Microsoft.Network' provider was not registered in the subscription (Azure Portal > Subscriptions > Resource providers > Microsoft.Network --> register)

    but the error is still weird as other requests to the same provider (eg. providers/Microsoft.Network/virtualNetworks?api-version=2020-07-01) returned a 200 even if no resources exist in the subscription

    1 person found this answer helpful.
    0 comments No comments