Tôi đã lưu mẫu cánh tay của mình với phần mở rộng yaml thay vì phần mở rộng json, vì điều này, vscode đã thêm dấu phẩy ở cuối khi tôi lưu tệp.
Khi tôi đổi tên nó, tôi gặp lỗi này khi kiểm tra cú pháp mẫu cánh tay.

Cách khắc phục, có nhiều dòng như thế này và rất tiếc là mình không có file cũ để thay.
Tập tin của tôi:
{
"$schema": "https://schema.manager.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata":
{
"_máy phát điện":
{
"tên": "bắp tay",
"phiên bản": "0.4.613.9944",
"templateHash": "7822315097766237434",
},
},
"thông số":
{
"adminUsername":
{
"loại": "chuỗi",
"siêu dữ liệu": { "description": "Tên người dùng cho Máy ảo." },
},
"mật khẩu quản trị":
{
"loại": "secureString",
"độ dài tối thiểu": 12,
"siêu dữ liệu": { "description": "Mật khẩu cho Máy ảo." },
},
"publicIpName":
{
"loại": "chuỗi",
"giá trị mặc định": "myPublicIP",
"metadata":
{
"description": "Tên cho IP Công cộng được sử dụng để truy cập Máy ảo.",
},
},
"công khaiIPAllocationMethod":
{
"loại": "chuỗi",
"defaultValue": "Động",
"allowedValues": ["Động", "Tĩnh"],
"metadata":
{
"description": "Phương thức phân bổ cho IP Công cộng được sử dụng để truy cập Máy ảo.",
},
},
"công khaiIpSku":
{
"loại": "chuỗi",
"defaultValue": "Cơ bản",
"allowedValues": ["Cơ bản", "Chuẩn"],
"metadata":
{
"description": "SKU cho IP Công cộng được sử dụng để truy cập Máy ảo.",
},
},
"Phiên bản của hệ điều hành":
{
"loại": "chuỗi",
"defaultValue": "2019-Trung tâm dữ liệu",
"giá trị được phép":
[
"2008-R2-SP1",
"2012-Trung tâm dữ liệu",
"2012-R2-Trung tâm dữ liệu",
"2016-Máy chủ Nano",
"2016-Trung tâm dữ liệu có thùng chứa",
"2016-Trung tâm dữ liệu",
"2019-Trung tâm dữ liệu",
"2019-Trung tâm dữ liệu-Lõi",
"2019-Trung tâm dữ liệu-Lõi-đĩa nhỏ",
"2019-Trung tâm dữ liệu-Lõi-với-Vùng chứa",
"2019-Trung tâm dữ liệu-Lõi-với-Bộ chứa-đĩa nhỏ",
"2019-Trung tâm dữ liệu-smalldisk",
"2019-Trung tâm dữ liệu có thùng chứa",
"2019-Datacenter-with-Containers-smalldisk",
],
"metadata":
{
"description": "Phiên bản Windows dành cho máy ảo. Điều này sẽ chọn một hình ảnh được vá đầy đủ của phiên bản Windows cụ thể này.",
},
},
"vmsize":
{
"loại": "chuỗi",
"defaultValue": "Standard_D2_v3",
"metadata": { "description": "Kích thước của máy ảo." },
},
"vmName":
{
"loại": "chuỗi",
"defaultValue": "đơn giản-vm",
"metadata": { "description": "Tên của máy ảo." },
},
},
"chức năng": [],
"biến":
{
"StorageAccountName": "[format('bootdiags{0}', uniqueString(resourceGroup().id))]",
"nicName": "myVMNic",
"addressPrefix": "10.0.0.0/16",
"tên mạng con": "Mạng con",
"prefix mạng con": "10.0.0.0/24",
"virtualNetworkName": "MyVNET",
"networkSecurityGroupName": "mặc định-NSG",
"dnsLabelPrefix": "[toLower(format('{0}-{1}', tham số('vmName'), uniqueString(resourceGroup().id, tham số('vmName'))))]",
"location": "[resourceGroup().location]",
},
"tài nguyên":
[
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"tên": "[biến('tên tài khoản lưu trữ')]",
"vị trí": "[biến('vị trí')]",
"sku": { "name": "Standard_LRS" },
"loại": "Lưu trữ",
},
{
"loại": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2021-02-01",
"tên": "[tham số('publicIpName')]",
"vị trí": "[biến('vị trí')]",
"sku": { "name": "[parameters('publicIpSku')]" },
"tính chất":
{
"publicIPAllocationMethod": "[tham số('publicIPAllocationMethod')]",
"cài đặt dns":
{ "domainNameLabel": "[biến('dnsLabelPrefix')]" },
},
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-02-01",
"tên": "[biến('networkSecurityGroupName')]",
"vị trí": "[biến('vị trí')]",
"tính chất":
{
"Quy tắc bảo mật":
[
{
"tên": "mặc định-cho phép-3389",
"tính chất":
{
"ưu tiên": 1000,
"truy cập": "Cho phép",
"hướng": "Vào",
"DestinationPortRange": "3389",
"giao thức": "Tcp",
"sourcePortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
},
},
],
},
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-02-01",
"tên": "[biến('virtualNetworkName')]",
"vị trí": "[biến('vị trí')]",
"tính chất":
{
"Không gian địa chỉ":
{ "addressPrefixes": ["[biến('addressPrefix')]"] },
"mạng con":
[
{
"tên": "[biến('tên mạng con')]",
"tính chất":
{
"addressPrefix": "[biến('subnetPrefix')]",
"nhóm bảo mật mạng":
{
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', các biến('networkSecurityGroupName'))]",
},
},
},
],
},
"phụ thuộc":
[
"[resourceId('Microsoft.Network/networkSecurityGroups', các biến('networkSecurityGroupName'))]",
],
},
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2021-02-01",
"tên": "[biến('nicName')]",
"vị trí": "[biến('vị trí')]",
"tính chất":
{
"Cấu hình ip":
[
{
"tên": "ipconfig1",
"tính chất":
{
"privateIPAllocationMethod": "Động",
"địa chỉ IP công khai":
{
"id": "[resourceId('Microsoft.Network/publicIPAddresses', tham số('publicIpName'))]",
},
"mạng con":
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', các biến('virtualNetworkName'), các biến('subnetName'))]",
},
},
},
],
},
"phụ thuộc":
[
"[resourceId('Microsoft.Network/publicIPAddresses', tham số('publicIpName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', các biến('virtualNetworkName'))]",
],
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2021-03-01",
"tên": "[tham số('vmName')]",
"vị trí": "[biến('vị trí')]",
"tính chất":
{
"hardwareProfile": { "vmSize": "[tham số('vmSize')]" },
"Hồ sơ os":
{
"computerName": "[tham số('vmName')]",
"adminUsername": "[tham số('adminUsername')]",
"adminPassword": "[tham số('adminPassword')]",
},
"hồ sơ lưu trữ":
{
"hình ảnh tham khảo":
{
"nhà xuất bản": "MicrosoftWindowsServer",
"ưu đãi": "WindowsServer",
"sku": "[tham số('OSVersion')]",
"phiên bản": "mới nhất",
},
"osDisk":
{
"createOption": "TừHình ảnh",
"managedDisk": { "storageAccountType": "StandardSSD_LRS" },
},
"đĩa dữ liệu":
[{ "diskSizeGB": 1023, "lun": 0, "createOption": "Empty" }],
},
"hồ sơ mạng":
{
"giao diện mạng":
[
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', các biến('nicName'))]",
},
],
},
"hồ sơ chẩn đoán":
{
"bootDiagnostics":
{
"đã bật": đúng,
"storageUri": "[tham chiếu(resourceId('Microsoft.Storage/storageAccounts', biến('storageAccountName'))).primaryEndpoints.blob]",
},
},
},
"phụ thuộc":
[
"[resourceId('Microsoft.Network/networkInterfaces', các biến('nicName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', các biến('StorageAccountName'))]",
],
},
],
"đầu ra":
{
"tên máy chủ":
{
"loại": "chuỗi",
"giá trị": "[tham chiếu(resourceId('Microsoft.Network/publicIPAddresses', tham số('publicIpName'))).dnsSettings.fqdn]",
},
},
}