sing lam
sing lam

Reputation: 141

Retrieve connection endpoint for Azure cosmosdb for Postgresql Cluster by CLI

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

Answers (1)

Jahnavi
Jahnavi

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>

enter image description here

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>

enter image description here

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>

enter image description here

Note: The command az cosmosdb list-connection-strings is also used to list the connection strings, but it will be deprecated in the future.

enter image description here

Upvotes: 0

Related Questions