简体   繁体   English

如何在我的 ARM (JSON) 模板中的 Azure 漏洞评估基线定义中指定多行?

[英]How do I specify multiple rows in an Azure Vulnerability Assessment baseline definition in my ARM (JSON) template?

I'm trying to add some Azure Vulnerability Assessment baseline definitions to my ARM templates.我正在尝试将一些 Azure 漏洞评估基线定义添加到我的 ARM 模板中。 I use JSON for my ARM templates.我使用 JSON 作为我的 ARM 模板。 I cannot find any documentation on how to specify certain VA baseline definitions, though, namely ones that need to have multiple rows in the baselines.不过,我找不到任何关于如何指定某些 VA 基线定义的文档,即那些需要在基线中包含多行的文档。

Specifically, I'm trying to add a baseline defintiion for VA2109.具体来说,我正在尝试为 VA2109 添加基线定义。 I can locate the documentation for how to define a baseline VA entry in a general sense, which is here...我可以找到有关如何在一般意义上定义基线 VA 条目的文档,在此处...

https://learn.microsoft.com/en-us/azure/templates/microsoft.sql/servers/databases/vulnerabilityassessments/rules/baselines?tabs=json https://learn.microsoft.com/en-us/azure/templates/microsoft.sql/servers/databases/vulnerabilityassessments/rules/baselines?tabs=json

And then I can locate the description of VA2109 in here...然后我可以在这里找到 VA2109 的描述......

https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-database-vulnerability-assessment-rules#authentication-and-authorization https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-database-vulnerability-assessment-rules#authentication-and-authorization

But neither of those tell me how to include more than one user-role mapping.但是这些都没有告诉我如何包含多个用户角色映射。 For example, below is what I currently have, which works and lets me specify that a user should have data writer role.例如,下面是我目前拥有的,它可以工作并让我指定用户应该具有数据编写器角色。 But, I also want to specify that the user should have data reader and ddl admin roles.但是,我还想指定用户应该具有数据读取器和 ddl 管理员角色。

{
  "type": "Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines",
  "apiVersion": "2021-02-01-preview",
  "name": "[concat(variables('sqlServerName'), '/', variables('databaseName'), '/default/VA2109/Default')]",
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers/databases', variables('sqlServerName'), variables('databaseName'))]"
  ],
  "properties": {
    "baselineResults": [
      {
        "result": ["wibuser", "db_datawriter"]
      }
    ]
  }
}

I was able to find an example of what I want using PowerShell. In PowerShell, you can just provide and array of arrays. The PowerShell example can be found here...我能够使用 PowerShell 找到我想要的示例。在 PowerShell 中,您可以只提供 arrays 的数组。可以在此处找到 PowerShell 示例...

https://learn.microsoft.com/en-us/powershell/module/sqlserver/new-sqlvulnerabilityassessmentbaseline?view=sqlserver-ps#example-2--create-a-new-security-check-baseline-manually https://learn.microsoft.com/en-us/powershell/module/sqlserver/new-sqlvulnerabilityassessmentbaseline?view=sqlserver-ps#example-2--create-a-new-security-check-baseline-manually

So I adjusted my ARM to do the same thing, but it throws an error saying invalid ARM template.所以我调整了我的 ARM 来做同样的事情,但是它抛出了一个错误,说 ARM 模板无效。 The adjusted ARM I tried looks like below...我试过的调整后的 ARM 如下所示......

{
  "type": "Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines",
  "apiVersion": "2021-02-01-preview",
  "name": "[concat(variables('sqlServerName'), '/', variables('databaseName'), '/default/VA2109/Default')]",
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers/databases', variables('sqlServerName'), variables('databaseName'))]"
  ],
  "properties": {
    "baselineResults": [
      {
        "result": [
          ["wibuser", "db_datawriter"],
          ["wibuser", "db_datareader"]
        ]
      }
    ]
  }
}

Does anybody know how to specify multiple rows in a VA baseline resource when using ARM JSON?有人知道在使用 ARM JSON 时如何在 VA 基线资源中指定多行吗? Or perhaps know where to find documentation for all of these VA definitions?或者也许知道在哪里可以找到所有这些 VA 定义的文档?

Note that baselineResults is an array of rows.请注意,baselineResults 是一个行数组。
You will need to add each row as an JSON object to that array.您需要将每一行作为 JSON object 添加到该数组。

Also, note that each result row should include all columns so you should also include "Principal Type" and "Authentication Type" rows.另请注意,每个结果行都应包括所有列,因此您还应包括“主体类型”和“身份验证类型”行。

It should look something like that:它应该看起来像这样:

{
  "type": "Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines",
  "apiVersion": "2021-02-01-preview",
  "name": "[concat(variables('sqlServerName'), '/', variables('databaseName'), '/default/VA2109/Default')]",
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers/databases', variables('sqlServerName'), variables('databaseName'))]"
  ],
  "properties": {
    "baselineResults": [
      {
        "result":  ["wibuser", "db_datawriter", "SQL_USER", "NONE"]
      },
      {
        "result":  ["wibuser", "db_datareader", "SQL_USER", "NONE"]
      }
    ]
  }
}

I added dummy values for "Principal Type" and "Authentication Type" rows, fill your own我为“主体类型”和“身份验证类型”行添加了虚拟值,填写你自己的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL漏洞评估中的“VA2065-服务器级防火墙规则”怎么办? - What to do about "VA2065 - Server-level firewall rules" in SQL Vulnerability Assessment? 如何让我的 Azure C# function 应用返回 json? - How do I get my Azure C# function app to return json? 如何使用ARM模板为azure自动化设置账户运行? - How to set run as account for azure automation using ARM template? 如何在 Azure DevOps 管道中引用 GitHub 中托管的 ARM 模板? - How to reference an ARM Template hosted in GitHub in an Azure DevOps Pipeline? AZURE - 将 VM ARM 模板保存到模板 - AZURE - Save VM ARM Template to Templates Azure 容器实例 FQDN - 我如何在 ARM 中设置它(使用 az create 不起作用) - Azure Container Instance FQDN - how do I set it in the ARM (using az create does not work) 如何在现有 su.net 或我创建的 su.net 模板中指定 su.netID? - How do I specify subnetID in cloudformation template, either from existing subnet or one that I create? Azure ARM 具有多个扩展和多个 VM - Azure ARM with Multiple Extensions and multiple VMs 我们如何在 function 应用程序的 ARM 模板中包含连接字符串? - how do we include connectionstrings in ARM template for function app? 如何在 arm 模板中使用条件或? - How to use conditional OR in arm template?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM