Skip to content

Instantly share code, notes, and snippets.

@DataSic
Created May 29, 2018 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DataSic/82c65d1785b0545ea7c4d1ba210e35ac to your computer and use it in GitHub Desktop.
Save DataSic/82c65d1785b0545ea7c4d1ba210e35ac to your computer and use it in GitHub Desktop.
CosmosDB - Add Firewall Rule
<#
https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/databaseaccounts
#>
# Init variables
$resourceGroupName = "ResourceGroupName"
$resourceType = "Microsoft.DocumentDB/databaseAccounts"
$apiVersion = "2015-04-08"
$cosmosDbAccountName = "CosmosDbAccountName"
$propertyObject = @{"databaseAccountOfferType"="Standard";
"ipRangeFilter"="IpAddress1,IpAddress2";}
# Update firewall rules
$setAzureRmResourceSplat = @{
ResourceType = $resourceType
ApiVersion = $apiVersion
PropertyObject = $propertyObject
Name = $cosmosDbAccountName
ResourceGroupName = $resourceGroupName
Force = $true
}
Set-AzureRmResource @setAzureRmResourceSplat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment