gpt4 book ai didi

azure - 通过 ARM 模板在 Azure SQL Server 上启用漏洞评估

转载 作者:行者123 更新时间:2023-12-02 22:11:57 24 4
gpt4 key购买 nike

我已通过 ARM 模板创建了我的 Azure SQL 服务器。为了启用漏洞评估,我需要启用高级数据安全性。我在 SQL Server 资源的资源括号内的 ARM 模板中使用以下代码来启用此功能。

 {
"name": "vulnerabilityAssessments",
"type": "vulnerabilityAssessments",
"apiVersion": "2018-06-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('sqlServerName'))]"
],
"properties": {
"storageContainerPath": "[concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/vulnerability-assessment/')]",
"storageAccountAccessKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value]",
"recurringScans": {
"isEnabled": true,
"emailSubscriptionAdmins": false,
"emails": "[parameters('emailaddresses')]"
}
}
},

如您所见,我将存储帐户设置为漏洞评估,但是当我部署此帐户时,出现以下错误:

VulnerabilityAssessmentADSIsDisabled", "message": "Advanced Data Security should be enabled in order to use Vulnerability Assessment."

当我查看 SQL Server 的高级数据安全 Blade 时,我看到已设置: enter image description here

如果我手动设置存储帐户。漏洞评估已启用....我尝试更改数据库级别的漏洞评估括号,并尝试调试属性中的存储帐户引用,但似乎看不到我做错了什么或我一直忘记什么?有人尝试过这样做吗?

PS:就像您在图像中看到的那样,定期重复扫描已关闭,而我已在漏洞评估的重复扫描数组中启用了此功能。

最佳答案

您遇到的问题是由于部署带有漏洞评估的 ARM 模板,但没有先启用高级数据安全性而导致的。

您必须在 ARM 模板中部署高级数据安全,并在漏洞评估 block 中添加依赖项,因此只有在部署高级数据安全后才会部署它。

例如:

{
"apiVersion": "2017-03-01-preview",
"type": "Microsoft.Sql/servers/securityAlertPolicies",
"name": "[concat(parameters('serverName'), '/Default')]",
"properties": {
"state": "Enabled",
"disabledAlerts": [],
"emailAddresses": [],
"emailAccountAdmins": true
}
},
{
"apiVersion": "2018-06-01-preview",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"name": "[concat(parameters('serverName'), '/Default')]",
"properties": {
"storageContainerPath": "[if(parameters('enableADS'), concat(reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageName')), '2018-07-01').primaryEndpoints.blob, 'vulnerability-assessment'), '')]",
"storageAccountAccessKey": "[if(parameters('enableADS'), listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageName')), '2018-02-01').keys[0].value, '')]",
"recurringScans": {
"isEnabled": true,
"emailSubscriptionAdmins": true,
"emails": []
}
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('serverName'))]",
"[concat('Microsoft.Sql/servers/', parameters('serverName'), '/securityAlertPolicies/Default')]"

]
}

请注意,在此示例中,我假设您正在使用现有存储。如果您在同一个 ARM 模板内部署存储,则还必须为其添加依赖项(在“dependsOn”下):

"[concat('Microsoft.Storage/storageAccounts/', variables('storageName'))]"

关于azure - 通过 ARM 模板在 Azure SQL Server 上启用漏洞评估,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57056770/

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