且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过PowerShell从公共Azure数据中心启用CosmosDb访问

更新时间:2023-02-14 09:41:05

Robdeijn,

您可以使用Powershell设置IP限制和过滤,但不能使用Powershell直接修改允许来自"访问权限.配置.但是,您可能可以通过ARM模板进行设置.请查看以下文档: Azure Cosmos DB防火墙支持

此文档中有一部分:了解以下内容的结构和语法Azure资源管理器模板

如果您还有其他疑问,请告诉我.

此致

迈克


Hi,

In the Azure portal I have an option to enable access from public Azure datacenters when configuring the firewall for Cosmos DB:



In VSTS I want to enable this option using PowerShell since we run a test suite there that also does some setup / teardown that requires access to Cosmos DB.

The PowerShell samples for Cosmos DB describe how to add IP restrictions, but not how to enable this particular option. 

Is this possible?

Hi Robdeijn,

You can use Powershell to set IP restrictions and filtering but you cannot use Powershell to directly modify the "Allow access from" configuration. You might, however, be able to set this via ARM Templates. Please take a look at the following documentation: Azure Cosmos DB firewall support

There is a section in this document: Using Azure Resource Manager Template to set up the IP access control

If you configure the desired functionality for this and then export the ARM template, in the exported Json file, you should see how this is enabled. Keep this, and use it to enable/disable features.

Understand the structure and syntax of Azure Resource Manager Templates

Please let me know if you have any additional questions. 

Regards,

Mike