question

LakshmipathiKakarla-5683 avatar image
0 Votes"
LakshmipathiKakarla-5683 asked JamesTran-MSFT edited

Azure DNS Zones REST API Returning Bad Request Error

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

https://management.azure.com/subscriptions/{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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ErikvanNoorden-3519 avatar image
0 Votes"
ErikvanNoorden-3519 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JamesTran-MSFT avatar image
1 Vote"
JamesTran-MSFT answered LakshmipathiKakarla-5683 commented

@LakshmipathiKakarla-5683
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.
    63638-subid.gif

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

 GET https://management.azure.com/subscriptions/<SubscriptionID>/providers/Microsoft.Network/dnszones?api-version=2018-05-01

63618-getdnszoneslist.gif



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.


subid.gif (266.9 KiB)
getdnszoneslist.gif (256.7 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@LakshmipathiKakarla-5683
I just wanted to check in and see if you had any other questions or if you were able to resolve this issue?

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

0 Votes 0 ·

@JamesTran-MSFT

Thanks for taking time to look into this. When I tried with incorrect subscription id, I am getting different error.

Incorrect Subscription ID:
Subscription '3cc4rt5b-52dc-46ee-b387-67hbcdfe8258' not found. Check the spelling and casing and try again.

But I am getting below error for correct subscription id. The error message not helping to find out the root cause.

Valid Subscription ID:
Bad Request({"code":"BadRequest","message":"The specified subscription 7678v180e-49c7-4e9c-aec4-46953d92318c4 does not exist"})

Please advise on how to find exact root cause for above error.





0 Votes 0 ·