Reputation: 141
I am trying to retrieve the connection endpoint (coordinator name) for CosmosDB Cluster by Azure CLI but failed. The commands I tried are:
az cosmosdb show --name cosmospostgrepreprdjl1 --resource-group ABC
az postgres server show -g ABC --name cosmospostgrepreprdjl1
Both of the above return resource not found but this resource does exist and able to connect by db client. Please advise.
Upvotes: 1
Views: 556
Reputation: 7898
Resource not found but this resource does exist:
Check the subscription to see if the resource is present. If a subscription mismatch occurs, it may result in resource not found issues.
According to the MSDoc, there is a subscription
parameter that can be used to include the subscription when executing the az postgres server show
command.
I tried the below command as you and was able to retrieve the required information as shown.
az postgres server show --name newpser --resource-group <resourcegroup>
I also tried the az cosmosdb show
command in the below manner and was able to retrieve the required information successfully.
az cosmosdb show --name <cosmosdbaccountname> --resource-group <resourcegroup>
To retrieve the connection strings, use the AzCLI command az cosmosdb keys list and it worked as expected.
az cosmosdb keys list --type connection-strings --name <cosmosdbaccount> --resource-group <resourcegroup>
Note: The command az cosmosdb list-connection-strings
is also used to list the connection strings, but it will be deprecated in the future.
Upvotes: 0