This is concerning the Azure Deployment Template for a MongoDB Replica Set defined here mongodb-replica-set-centos.
When I run the recommended deployment commands to deploy the replica set, namely
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
where the resource group is already set up. I receive the following error:
{
"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": "{rn "status": "Failed",rn "error": {rn "code": "ResourceDeploymentFailure",rn "message": "The resource operation completed with terminal provisioning state 'Failed'.",rn "details": [rn {rn "code": "DeploymentFailed",rn "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",rn "details": [rn {rn "code": "BadRequest",rn "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}"rn }rn ]rn }rn ]rn }rn}"
},
{
"code": "Conflict",
"message": "{rn "status": "Failed",rn "error": {rn "code": "ResourceDeploymentFailure",rn "message": "The resource operation completed with terminal provisioning state 'Failed'.",rn "details": [rn {rn "code": "DeploymentFailed",rn "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",rn "details": [rn {rn "code": "BadRequest",rn "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}"rn }rn ]rn }rn ]rn }rn}"
}
]
}
}
The problem field is in both primary-resources.json and secondary-resources.json appears to be
"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')]"
}
]
}
}
},
And ascociated with the variable adminPasswordOrKey
. I have tried changing this to be both standard passwords and SSH keys of varying bit-depth, no luck…
How can I fix this?
Repro steps
- Run
az group create --name <resource-group-name> --location <resource-group-location>
where resource group exists. - Run
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
and step through the prompts - Enter the relevant in formation.
Further Investigation
I have just seen this answer (https://stackoverflow.com/a/60860498/626442) saying specifically that
Note: Please note that the only allowed path is /home//.ssh/authorized_keys due to a limitation of Azure.
I have changed this value of the path, no joy, same error. :'[
2
Answers
You forgot to pass parameters in
az deployment group create .... --parameters azuredeploy.parameters.json
. You can download azuredeploy.parameters.json and change values as needed. See https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-use-parameter-file?tabs=azure-cli#deploy-template for details.Specifically the error in the question complains about
adminUsername
parameter being empty. Bear in mind this user name is also being used in the home directory path, so limit yourself to lowcase ASCII a-z, numbers, underscore. No spaces, not special characters, no utf.Not related to the error, but be aware these necromancers use mongo 3.2 which was buried 4 years ago: https://www.mongodb.com/support-policy/lifecycles. Considering they open it wide to the internet you may have way more problems if you actually deploy it.
UPDATE
An example of the parameters I used:
DANGER: It will deploy publicly accessible mongodb replica set with publicly accessible credentials, so please delete the resources as soon as you are happy with testing/debugging
This is how deployment looks like on the portal:
If you’re using the Ed25519 key type, please note that Microsoft Azure does not currently support Ed25519 SSH keys for virtual machines (VMs). The supported SSH key types for VM authentication in Azure are RSA and DSA key types.
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/ed25519-ssh-keys