azure - 使用 ARM 模板在 cosmos Db 中启用 disableLocalAuth

标签 azure azure-cosmosdb azure-rm-template

我正在使用 ARM 模板部署 Azure Cosmos DB。我有两个参数文件,一个用于开发环境,一个用于 PROD,还有一个包含 Cosmos DB 配置的 Arm 模板。为了保护我的数据库,我必须将disableLocalAuth的参数设置为true,如下所示

"resources": [
    {
        "type": " Microsoft.DocumentDB/databaseAccounts",
        "properties": {
            "disableLocalAuth": true,
            // ...
        },
        // ...
    },
    // ...
 ]

我想在我的参数文件中添加其他参数,并在开发参数文件中将disableLocalAuth设置为false,对于PROD参数文件将disableLocalAuth设置为true

我需要示例,其中如何设置附加参数以反射(reflect)不同环境中的变化。

谢谢

最佳答案

这是一个包含该值参数的模板。

{
   "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
   "contentVersion": "1.0.0.0",
   "parameters": {
      "accountName": {
         "type": "string",
         "defaultValue": "[uniqueString(resourceGroup().id)]"
      },
 
      "disableLocalAuth": {
         "type": "bool",
         "defaultValue": false
      }
   },
   "resources": [
      {
         "type": "Microsoft.DocumentDB/databaseAccounts",
         "name": "[parameters('accountName')]",
         "apiVersion": "2021-10-15",
         "location": "West US",
         "kind": "GlobalDocumentDB",
         "properties": {
            "locations": [{ "locationName": "West US", "failoverPriority": 0 }],
            "databaseAccountOfferType": "Standard",
            "disableLocalAuth": "[parameters('disableLocalAuth')]" 
         }
      }
   ]
}

关于azure - 使用 ARM 模板在 cosmos Db 中启用 disableLocalAuth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73993173/

相关文章:

azure - .NET-Core 作为 Azure AppService 和本地的常见功能即服务功能

sql-server - 如何从 Azure SQL 迁移到 SQL Server?

azure - 从应用服务安全访问 CosmosDB

azure - 在 Azure DevOps 中从 ARM 模板创建的新资源组的角色分配授权失败

azure - 将多个 Bicep 模板发布到容器注册表

Azure 耐用功能 : JsonSerializationException by passing complex object from trigger to orchestrator

azure - 如何在Azure容器实例中设置自定义域名

azure - 如何使用azure JavaScript函数应用程序在cosmos DB中插入数据?

c# - Azure Function - Cosmos DB 删除文档问题

Azure - ARM 模板部署