How to enable "Allow public access from Azure services and resources within Azure to this cluster" for Azure Cosmos DB for PostgreSQL Cluster using CLI?

Jacky Lam 200 Reputation points
2023-03-28T05:57:06.2633333+00:00

Hi,

For my deployment script, I would like to know how can turn on the option "Allow public access from Azure services and resources within Azure to this cluster" in a "Azure Cosmos DB for PostgreSQL Cluster" resource by using CLI? Or which parameter can be used to turn on this in deployment tempate?

Thanks,

Jacky

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,403 questions
{count} votes

Accepted answer
  1. ShaktiSingh-MSFT 12,946 Reputation points Microsoft Employee
    2023-03-29T03:36:52.64+00:00

    Hi Jacky Lam • ,

    Welcome to Microsoft Q&A forum and thanks for using Azure services.

    As I understand, you want to enable "Allow public access from Azure services and resources within Azure to this cluster" for Azure Cosmos DB for PostgreSQL Cluster using CLI.

    We are sorry for the inconvenience that we don’t have native Azure CLI support enabled for Azure Cosmos DB for PostgreSQL yet.

    That said, there’s a workaround. You can use REST API call wrapped into Azure CLI wrapper (az rest) to manage firewall rules.

    For instance, to do this you would need to run the following command (these are placeholders that need to be replaced with actual values):

    az rest --method put --url https://management.azure.com/subscriptions/{subscription_ID}/resourceGroups/{resource_group}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{cluster_name}/firewallRules/AllowAllAzureIPAddressesRule?api-version=2022-11-08 --body @body.json
    

    with the following content in body.json file

    {
      "properties": {
    "startIpAddress": "0.0.0.0",
    "endIpAddress": "0.0.0.0"
      }
    }
    
    

    References:

    REST APIs: Create or update firewall rules

    Az rest

    We encourage you to share your feedback over the Azure Cosmos DB Feedback Channel which will help in getting the idea implemented by the concerned team depending upon the importance and up votes.

    Hope this helps. Please let us know if you have further queries. Thank you.


0 additional answers

Sort by: Most helpful