az cli doesn't list dns zones

Akkineni, Venkat R 0 Reputation points
2023-12-11T08:41:07.2+00:00

Hi

az network dns zone list returns empty array. I am using my personal account to run the command. When I login to azure portal using the same account, I see the dns zones listed. Do I need additional roles to be able to run the above command ?

az role assignment list --assignee ${assignee} returns empty array.

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
627 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Akkineni, Venkat R 0 Reputation points
    2023-12-13T05:40:47.55+00:00

    Hi, thankyou for the response. I was able to resolve the issue after setting the subscription explicitly using the command below.

    az set --subscription-id [ID]
    
    0 comments No comments

  2. ChaitanyaNaykodi-MSFT 24,231 Reputation points Microsoft Employee
    2023-12-13T22:24:25.7566667+00:00

    @Akkineni, Venkat R

    Thank you for getting back and glad to know the issue was resolved.

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I am summarizing the troubleshooting steps above and posting the solution as an answer. It will be hlpful if you could click "Accept the answer" which might be beneficial to other community members reading this thread.

    Troubleshooting steps followed:

    I understand you can see the DNS zones listed when you login into the Azure Portal.

    • Can you please try and run the command az network dns zone list using Azure Could Shell? This will let us know if the issue is in the local set-up or the user needs any additional role assignment. Please share a screenshot if you observe any errors.
    • If the command above is successful, on your local machine you can follow the documentation here to validate if the correct tenant and subscriptions were selected.

    Solution obtained:

    You were able to resolve the issue after setting the subscription explicitly using the command below.

    az set --subscription-id [ID]
    

    Thank you!

    0 comments No comments