簡體   English   中英

Azure ARM 模板“VmAgentNotRunning”

[英]Azure ARM template "VmAgentNotRunning"

我正在嘗試為 SQL IaaS 部署構建一個模板,包括 VM、SQL IaaS 擴展和 SQL IaaS 機器。 部署 SQL IaaS 機器時出現錯誤,因為我認為 VM 尚未完全完成部署。

我當前的模板如下所示:

        {
            "name": "[parameters('virtualMachineName')]",
            "type": "Microsoft.Compute/virtualMachines",
            "apiVersion": "2018-10-01",
            "location": "[variables('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
            ],
            "properties": {
                "hardwareProfile": {
                    "vmSize": "[parameters('virtualMachineSize')]"
                },
                "osProfile": {
                    "computerName": "[parameters('virtualMachineName')]",
                    "adminUsername": "",
                    "adminPassword": "",
                    "windowsConfiguration": {
                        "provisionVMAgent": true
                    }
                },
                "storageProfile": {
                    "imageReference": {
                        "publisher": "MicrosoftSQLServer",
                        "offer": "[variables('sqlOffer')]",
                        "sku": "[parameters('sqlEdition')]",
                        "version": "latest"
                    },
                    "osDisk": {
                        "createOption": "FromImage",
                        "osType": "Windows",
                        "caching": "ReadWrite",
                        "name": "[variables('OSDiskName')]",
                        "managedDisk": {
                            "storageAccountType": "Premium_LRS"
                        }
                    },
                    "dataDisks": [
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA1')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "StandardSSD_LRS"
                            },
                            "lun": 0,
                            "diskSizeGB": "[parameters('sizeOfUserDBDiskInGB')]",
                            "caching": "ReadOnly"
                        },
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA2')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "Standard_LRS"
                            },
                            "lun": 1,
                            "diskSizeGB": 128,
                            "caching": "ReadOnly"
                        },
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA3')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "Standard_LRS"
                            },
                            "lun": 2,
                            "diskSizeGB": 1023,
                            "caching": "ReadOnly"
                        },
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA4')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "Standard_LRS"
                            },
                            "lun": 4,
                            "diskSizeGB": 512,
                            "caching": "ReadOnly"
                        },
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA5')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "Standard_LRS"
                            },
                            "lun": 5,
                            "diskSizeGB": 512,
                            "caching": "None"
                        },
                        {
                            "name": "[concat(parameters('virtualMachineName'),'-DATA6')]",
                            "createOption": "Empty",
                            "managedDisk": {
                                "storageAccountType": "Standard_LRS"
                            },
                            "lun": 6,
                            "diskSizeGB": 512,
                            "caching": "None"
                        }
                    ]
                },
                "networkProfile": {
                    "networkInterfaces": [
                        {
                            "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
                        }
                    ]
                },
                "diagnosticsProfile": {
                    "bootDiagnostics": {
                        "enabled": true,
                        "storageUri": "[reference(resourceId(resourceGroup().name, 'Microsoft.Storage/storageAccounts', parameters('diagnosticsStorageAccountName')), '2015-06-15').primaryEndpoints['blob']]"
                    }
                }
            },
            "tags": {
                "Application Stack": "[parameters('Application Stack')]",
                "Business Contact": "[parameters('Business Contact')]",
                "Associated to": "[resourceGroup().name]",
                "Business Owner": "[parameters('Business Owner')]",
                "BusinessUnit": "[parameters('Business Unit')]",
                "Department": "[parameters('Department')]",
                "Region": "[parameters('Region')]",
                "Type": "[variables('VMType')]"
            }
        },
        {
            "apiVersion": "2015-06-15",
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "[concat(parameters('virtualMachineName'), '/SqlIaasExtension')]",
            "location": "[variables('location')]",
            "dependsOn": [
                "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
            ],
            "properties": {
                "type": "SqlIaaSAgent",
                "publisher": "Microsoft.SqlServer.Management",
                "typeHandlerVersion": "1.2",
                "autoUpgradeMinorVersion": "true",
                "settings": {
                    "AutoTelemetrySettings": {
                        "Region": "[variables('location')]"
                    },
                    "AutoPatchingSettings": {
                        "PatchCategory": "WindowsMandatoryUpdates",
                        "Enable": true,
                        "DayOfWeek": "Saturday",
                        "MaintenanceWindowStartingHour": "2",
                        "MaintenanceWindowDuration": "180"
                    },
                    "ServerConfigurationsManagementSettings": {
                        "SQLConnectivityUpdateSettings": {
                            "ConnectivityType": "Private",
                            "Port": "1433"
                        },
                        "SQLWorkloadTypeUpdateSettings": {
                            "SQLWorkloadType": "General"
                        },
                        "SQLStorageUpdateSettings": {
                            "DiskCount": 1,
                            "NumberOfColumns": 1,
                            "StartingDeviceID": "2",
                            "DiskConfigurationType": "NEW"
                        },
                        "AdditionalFeaturesServerConfigurations": {
                            "IsRServicesEnabled": "false"
                        }
                    }
                },
                "protectedSettings": {
                    "SQLAuthUpdateUserName": "",
                    "SQLAuthUpdatePassword": ""
                }
            }
        },
        {
            "type": "Microsoft.SqlVirtualMachine/sqlVirtualMachines",
            "apiVersion": "2017-03-01-preview",
            "name": "[parameters('virtualMachineName')]",
            "location": "[variables('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]"
            ],
            "properties": {
                "virtualMachineResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]",
                "sqlImageOffer": "[variables('sqlOffer')]",
                "sqlServerLicenseType": "AHUB",
                "sqlManagement": "Full",
                "sqlImageSku": "[parameters('sqlEdition')]"
            }
        }

最后一部分部署 Azure SQL IaaS 計算機,它依賴於運行的 VM 代理。 我收到一個錯誤說,

    "error": {
        "code": "VmAgentNotRunning",
        "message": "The VM agent in Virtual Machine: '/subscriptions/{GUID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Compute/virtualMachines/{VmName}' is not in running state. Please make sure it is installed and in running state and try again later."
    }

有沒有辦法在部署 SQL IaaS 機器之前添加等待或添加對正在運行的代理的依賴? 如果不部署它,模板效果很好。 部署機器后,我可以運行 powershell 腳本來創建對象,但我試圖避免這種情況。 提前致謝。

偶然發現這篇文章,解釋了我的問題。 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sql/virtual-machines-windows-sql-register-with-resource-provider?tabs=azure-cli%2Cpowershell#management-模式

訣竅是將“sqlManagement”:“Full”更改為“sqlManagement”:“LightWeight”,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM