![](/img/trans.png)
[英]Is there a powershell command to add ipRules to CosmosDB in azure?
[英]Powershell command to update IP address in Azure CosmosDB
我正在嘗試通過在 Azure Cosmos DB 中添加單個 IP 來更新防火牆規則。
我正在使用命令
# Get existing IP Rules
$databaseAccountIpRules = (Get-AzCosmosDBAccount -ResourceGroupName $dbResourceGroup -Name $dbAccount).IpRules
# Append IP Rules
$databaseAccountIpRules += $customIP
# Upload the updated IP Rules
Update-AzCosmosDBAccount -ResourceGroupName $databaseResourceGroup -Name $databaseAccount -IpRule $databaseAccountIpRules
這給了我一個錯誤 -
Update-AzCosmosDBAccount: Could not parse supplied IpAddressOrRange: 'Microsoft.Azure.Management.CosmosDB.Models.IpAddressOrRange'. Please ensure correct IPv4 formatting and CIDR notation for IP range.
好的,所以我需要這樣做
# Get existing IP Rules
$databaseAccountIpRules = (Get-AzCosmosDBAccount -ResourceGroupName $dbResourceGroup -Name $dbAccount).IpRules.IpAddressOrRangeProperty
# Append IP Rules
$databaseAccountIpRules += $customIP
# Upload the updated IP Rules
Update-AzCosmosDBAccount -ResourceGroupName $databaseResourceGroup -Name $databaseAccount -IpRule $databaseAccountIpRules
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.