是否有 powershell 命令将 ipRules 添加到天蓝色的 CosmosDB?

Is there a powershell command to add ipRules to CosmosDB in azure?

我正在尝试使用 powershell 在 azure 中向 CosmosDb(防火墙)的网络规则添加一个 ip。

许多其他资源似乎都有可用于执行此操作的命令(例如 keyvault Add-AzKeyVaultNetworkRule -VaultName myvault -IpAddressRange "10.0.1.0/24"),但我找不到任何适用于 CosmosDb 的命令。有谁知道它是否真的存在?谢谢!

是的,Update-AzCosmosDBAccount

$resourceGroupName = "myResourceGroup"
$accountName = "my-cosmos-account"
$ipFilter = @("10.0.0.0/8", "11.0.1.0/24")
$allowAzureAccess = $true

if ($true -eq $allowAzureAccess) {
    $ipFilter += "0.0.0.0"
}

Update-AzCosmosDBAccount -ResourceGroupName $resourceGroupName `
-Name $accountName -IpRangeFilter $ipFilter