Update programmatically (using Azure REST API or .NET SDK) IP address ranges of an Azure Cosmos DB Firewall

Milen Denev 91 Reputation points

I am trying to find how to update the IP address ranges using the Azure REST API (or .NET SDK). The documentation seems to do not have any information.
I tried different requests here https://management.azure.com//subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/firewall without success.
Something similar for Azure SQL REST API: https://learn.microsoft.com/en-us/rest/api/sql/2021-02-01-preview/firewall-rules/create-or-update

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
917 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
1,175 questions
Azure Firewall
Azure Firewall
An Azure network security service that is used to protect Azure Virtual Network resources.
334 questions
No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 17,291 Reputation points Microsoft Employee

    Hi @Milen Denev ,

    Thanks for using Microsoft Q&A !!
    You can use Update Rest API to update IP Address ranges.
    You need to pass only properties you want to update as part of this API request body while calling the API.
    Your API Request URL will look like below -
    PATCH https://management.azure.com/subscriptions/{Subscription Id}/resourceGroups/{Resource Group}/providers/Microsoft.DocumentDB/databaseAccounts/{Account Name}?api-version=2021-04-15

    API request body will be like below:

          "location": "westus",  
           "properties": {  
           "databaseAccountOfferType": "Standard",  
           "ipRules": [  
            "ipAddressOrRange": ""  
            "ipAddressOrRange": ""  


    Please let me know if you have any questions.



    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

0 additional answers

Sort by: Most helpful