这与此处定义的MongoDB副本集的Azure部署模板mongodb-replica-set-centos有关。
当我运行推荐的部署命令来部署副本集时,即
az group create --name <resource-group-name> --location <resource-group-location> # Use this command when you need to create a new resource group for your deployment.
az deployment group create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/migr8/AzureDeploymentTemplates/main/mongo/mongodb-replica-set-centos/azuredeploy.json
其中资源组已设置。我收到以下错误:
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"{\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"InvalidParameter\\\",\\r\\n \\\"message\\\": \\\"The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid.\\\",\\r\\n \\\"target\\\": \\\"linuxConfiguration.ssh.publicKeys.keyData\\\"\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
},
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"{\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"InvalidParameter\\\",\\r\\n \\\"message\\\": \\\"The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid.\\\",\\r\\n \\\"target\\\": \\\"linuxConfiguration.ssh.publicKeys.keyData\\\"\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
}
]
}
}
问题字段位于primary-resources.json和secondary-resources.json中,似乎是
"variables": {
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('subnet').vnet, parameters('subnet').name)]",
"securityGroupName": "[concat(parameters('namespace'), parameters('vmbasename'), 'nsg')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPasswordOrKey')]"
}
]
}
}
},
并与变量adminPasswordOrKey
关联。我尝试将其更改为标准密码和不同位深度的SSH密钥,没有运气......
我该怎么解决这个问题?
复制步骤
1.在存在资源组的位置运行az group create --name <resource-group-name> --location <resource-group-location>
。
1.运行az deployment group create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/migr8/AzureDeploymentTemplates/main/mongo/mongodb-replica-set-centos/azuredeploy.json
并逐步完成提示
1.输入相关信息。
进一步调查
我刚刚看到这个答案(https://stackoverflow.com/a/60860498/626442)明确地说
注意:请注意,由于Azure的限制,唯一允许的路径是/home//.ssh/authorized_keys。
我已经改变了这条道路的价值,没有欢乐,同样的错误。
2条答案
按热度按时间nfzehxib1#
您忘记在
az deployment group create .... --parameters azuredeploy.parameters.json
中传递参数。您可以下载azuredeploy.parameters.json并根据需要更改值。有关详细信息,请参阅https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-use-parameter-file?tabs=azure-cli#deploy-template。具体来说,问题中的错误抱怨
adminUsername
参数为空。请记住,此用户名也用于主目录路径中,因此请限制自己使用小写ASCII a-z,数字,下划线。没有空格,没有特殊字符,没有utf。与错误无关,但要注意这些亡灵 Mage 使用mongo3.2,这是4年前埋葬:https://www.mongodb.com/support-policy/lifecycles。考虑到他们向互联网开放,如果你实际部署它,你可能会遇到更多的问题。
更新
我使用的参数示例:
危险:会使用可公开访问的凭证部署可公开访问的mongodb副本集,请在测试/调试满意后尽快删除资源
以下是门户上的部署:
ssm49v7z2#
如果您使用的是Ed25519密钥类型,请注意Microsoft Azure当前不支持虚拟机(VM)的Ed25519 SSH密钥。Azure中VM身份验证支持的SSH密钥类型是RSA和DSA密钥类型。
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/ed25519-ssh-keys