gpt4 book ai didi

azure - 用于更新 Azure CosmosDB 中的 IP 地址的 Powershell 命令

转载 作者:行者123 更新时间:2023-12-03 03:44:02 29 4
gpt4 key购买 nike

我尝试通过在 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

关于azure - 用于更新 Azure CosmosDB 中的 IP 地址的 Powershell 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69938784/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com