如何修复 arm 模板创建存储账户的错误?

如何修复 arm 模板创建存储账户的错误?

我已经导出现有资源的 ARM 模板并修改了该模板。

但是在部署相同内容时,会出现无效 xml 错误。

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "storageAccounts_zuscutaastd1shared": {
        "defaultValue": "zuscutaastd1shared",
        "type": "String"
    }
},
"variables": {},
"resources": [
    {
        "type": "Microsoft.Storage/storageAccounts",
        "apiVersion": "2022-09-01",
        "name": "[parameters('storageAccounts_zuscutaastd1shared')]",
        "location": "centralus",
        "tags": {
            "wk_application_name": "AlwaysOn-Supportability",
        },
        "sku": {
            "name": "Standard_RAGRS",
            "tier": "Standard"
        },
        "kind": "StorageV2",
        "properties": {
            "dnsEndpointType": "Standard",
            "defaultToOAuthAuthentication": false,
            "publicNetworkAccess": "Enabled",
            "allowCrossTenantReplication": true,
            "routingPreference": {
                "routingChoice": "InternetRouting",
                "publishMicrosoftEndpoints": false,
                "publishInternetEndpoints": false
            },
            "minimumTlsVersion": "TLS1_2",
            "allowBlobPublicAccess": true,
            "allowSharedKeyAccess": true,
            "networkAcls": {
                "bypass": "AzureServices",
                "virtualNetworkRules": [],
                "ipRules": [],
                "defaultAction": "Allow"
            },
            "supportsHttpsTrafficOnly": true,
            "encryption": {
                "requireInfrastructureEncryption": false,
                "services": {
                    "file": {
                        "keyType": "Account",
                        "enabled": true
                    },
                    "blob": {
                        "keyType": "Account",
                        "enabled": true
                    }
                },
                "keySource": "Microsoft.Storage"
            },
            "accessTier": "Hot"
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/blobServices",
        "apiVersion": "2022-09-01",
        "name": "[concat(parameters('storageAccounts_zuscutaastd1shared'), '/default')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_zuscutaastd1shared'))]"
        ],
        "sku": {
            "name": "Standard_RAGRS",
            "tier": "Standard"
        },
        "properties": {
            "changeFeed": {
                "enabled": false
            },
            "restorePolicy": {
                "enabled": false
            },
            "containerDeleteRetentionPolicy": {
                "enabled": true,
                "days": 7
            },
            "cors": {
                "corsRules": []
            },
            "deleteRetentionPolicy": {
                "allowPermanentDelete": false,
                "enabled": true,
                "days": 7
            },
            "isVersioningEnabled": false
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/fileServices",
        "apiVersion": "2022-09-01",
        "name": "[concat(parameters('storageAccounts_zuscutaastd1shared'), '/default')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_zuscutaastd1shared'))]"
        ],
        "sku": {
            "name": "Standard_RAGRS",
            "tier": "Standard"
        },
        "properties": {
            "protocolSettings": {
                "smb": {}
            },
            "cors": {
                "corsRules": []
            },
            "shareDeleteRetentionPolicy": {
                "enabled": true,
                "days": 7
            }
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/queueServices",
        "apiVersion": "2022-09-01",
        "name": "[concat(parameters('storageAccounts_zuscutaastd1shared'), '/default')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_zuscutaastd1shared'))]"
        ],
        "properties": {
            "cors": {
                "corsRules": []
            }
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/tableServices",
        "apiVersion": "2022-09-01",
        "name": "[concat(parameters('storageAccounts_zuscutaastd1shared'), '/default')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_zuscutaastd1shared'))]"
        ],
        "properties": {
            "cors": {
                "corsRules": []
            }
        }
    }
]
    
        }
   

当我尝试修复时,出现错误,因为模板中的日期错误,但这与 UI 生成的日期相同。

请建议需要进行哪些更正以及需要使用哪些具体工具进行更正。

答案1

您可以使用 fileServices -> protocolSettings 的默认设置

"protocolSettings": {
        "smb": {
            "authenticationMethods": 'NTLMv2;Kerberos'
            "channelEncryption": 'AES-128-CCM;AES-128-GCM;AES-256-GCM'
            "kerberosTicketEncryption": 'RC4-HMAC;AES-256'
            "versions": 'SMB2.1;SMB3.0;SMB3.1.1'
        }
    }

文件服务

相关内容