gpt4 book ai didi

azure - 使用 Terraform 在存储帐户上启用 Microsoft Defender for Storage 扫描恶意软件

转载 作者:行者123 更新时间:2023-12-03 01:59:34 24 4
gpt4 key购买 nike

我尝试在使用 terraform 的存储帐户上使用“Microsoft Defender for Storage”启用恶意软件扫描,但我不知道如何执行此操作。 Terraform 不支持吗?我正在尝试在“Microsoft Defender For Cloud”上启用“上传恶意软件扫描”选项。是否有其他方法可以以编程方式执行此操作(如果 Terraform 尚未支持)? enter image description here

最佳答案

这就是我使用 ARM 模板解决它的方法。在资源定义中,“template_body”引用模板主体文件“malware-scan-configuration.json”

resource "azurerm_template_deployment" "malware" {
name = "${module.app_service.default_site_hostname}.Scan"
resource_group_name = module.resource_group.name
template_body = file("templates/malware-scan-configuration.json")

parameters = {
storage_account_name = my_storage_storage_account_name
subscription_id = my_subscription_id
resource_group = my_resource_group_name
event_grid_topicName = my_event_grid_topic_name
cap_gb_per_month = 5000
}
deployment_mode = "Incremental"
depends_on = [
]
}

模板正文文件:ma​​lware-scan-configuration.json

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storage_account_name": {
"type": "string"
},
"subscription_id": {
"type": "string"
},
"resource_group": {
"type": "string"
},
"event_grid_topicName": {
"type": "string"
},
"cap_gb_per_month": {
"type": "int"
}
},
"resources": [
{
"type": "Microsoft.Security/DefenderForStorageSettings",
"apiVersion": "2022-12-01-preview",
"name": "current",
"properties": {
"isEnabled": true,
"malwareScanning": {
"onUpload": {
"isEnabled": true,
"capGBPerMonth": "[parameters('cap_gb_per_month')]"
},
"scanResultsEventGridTopicResourceId": "[concat('/subscriptions/', parameters('subscription_id'), '/resourceGroups/', parameters('resource_group'), '/providers/Microsoft.EventGrid/topics/', parameters('event_grid_topicName'))]"
},
"sensitiveDataDiscovery": {
"isEnabled": false
},
"overrideSubscriptionLevelSettings": true
},
"scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storage_account_name'))]"
}
],

"outputs": {}
}

关于azure - 使用 Terraform 在存储帐户上启用 Microsoft Defender for Storage 扫描恶意软件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76867155/

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