title | description | author | ms.author | ms.reviewer | ms.service | ms.custom | ms.topic | ms.date |
---|---|---|---|---|---|---|---|---|
Create an Azure Cosmos DB account with IP firewall |
Create an Azure Cosmos DB account with IP firewall |
seesharprun |
sidandrews |
mjbrown |
cosmos-db |
devx-track-azurecli |
sample |
02/21/2022 |
[!INCLUDENoSQL, MongoDB, Cassandra, Gremlin, Table]
The script in this article demonstrates creating an Azure Cosmos DB account with default values and IP Firewall enabled. It uses a API for NoSQL account, but these operations are identical across all database APIs in Azure Cosmos DB. To use this sample for other APIs, apply the ip-range-filter
parameter in the script to the az cosmosdb account create
command for your API specific script.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
- This article requires version 2.9.1 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
[!INCLUDE cli-launch-cloud-shell-sign-in.md]
:::code language="azurecli" source="~/azure_cli_scripts/cosmosdb/common/ipfirewall.sh" id="FullScript":::
[!INCLUDE cli-clean-up-resources.md]
az group delete --name $resourceGroup
This script uses the following commands. Each command in the table links to command specific documentation.
Command | Notes |
---|---|
az group create | Creates a resource group in which all resources are stored. |
az cosmosdb create | Creates an Azure Cosmos DB account. |
az group delete | Deletes a resource group including all nested resources. |
For more information on the Azure Cosmos DB CLI, see Azure Cosmos DB CLI documentation.
For Azure CLI samples for specific APIs see: