简体   繁体   English

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

[英]Powershell command to update IP address in Azure CosmosDB

I am trying to update firewall rules by adding a single IP in Azure Cosmos DB.我正在尝试通过在 Azure Cosmos DB 中添加单个 IP 来更新防火墙规则。

I am using command我正在使用命令

# 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

This is giving me an error -这给了我一个错误 -

Update-AzCosmosDBAccount: Could not parse supplied IpAddressOrRange: 'Microsoft.Azure.Management.CosmosDB.Models.IpAddressOrRange'. Please ensure correct IPv4 formatting and CIDR notation for IP range.

Okay so I needed to do this好的,所以我需要这样做

# 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.

相关问题 azure 中是否有 powershell 命令将 ipRules 添加到 CosmosDB? - Is there a powershell command to add ipRules to CosmosDB in azure? 如何通过 Azure CLI 将 IP 地址添加到 Cosmosdb 数据库防火墙 - How to add IP address to a Cosmosdb database firewall through the Azure CLI CosmosDb 防火墙、Azure IP 地址 - CosmosDb Firewall, Azure IP addresses 在Powershell中使用Azure CLI创建CosmosDB - Creating CosmosDB with Azure CLI in powershell 如何在 Office 365/Azure 中使用 Powershell 添加/更新自定义 DNS A 记录? 所以当ISP改变它时我可以更新IP地址 - How to add/ update custom DNS A Records using Powershell in Office 365/ Azure? So I can update IP address when ISP changes it Azure-Powershell 脚本错误(IP 地址增量) - Azure-Powershell Script error (ip address increment ) Azure NSG,理想情况下基于源IP地址PowerShell删除规则 - Azure NSG, rule deletion based on source IP address PowerShell ideally Azure Powershell (Az模块) 公开IP地址 - Azure Powershell (Az module) get public IP address 使用PowerShell为Azure中的现有nic分配公共IP地址 - Assigning a public ip address to an existing nic in Azure using powershell 如何使用 Powershell 7 将保留的 IP 地址分配给 Azure 上的云服务? - How to assign a reserved IP address to a cloud service on Azure using Powershell 7?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM