How to fix issue: The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid.

Bob Zhao 0 Reputation points Microsoft Employee
2024-08-21T20:52:22.6333333+00:00

I was creating a VM with Mairner with FIPS enabled with the following command:

az deployment group create -n <deployment name> -g <group name> --template-file ./marinerazuredeploy.json --parameters projectName=<project name> adminUsername=bob adminPublicKey=./.ssh/authoried_keys

and got the following error message:
{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/c962aa2b-4ef3-4d8f-b92f-7a97ca840e27/resourceGroups/BobAzureMonitorAgentInvestigationrg/providers/Microsoft.Resources/deployments/AzureMonitorAgentInvestigationgp","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"linuxConfiguration.ssh.publicKeys.keyData","message":"The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid."}]}}

The group has been created.

I created the authorized_key by running the command: ssh-keygen -t rsa -b 2048. And set the path to .ssh/authorized_key.

Anyone can help?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,991 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 25,166 Reputation points
    2024-08-22T19:35:56.09+00:00

    Hello @Bob Zhao

    It looks like there’s an issue with the SSH public key parameter in your deployment command. The error message indicates that the value of linuxConfiguration.ssh.publicKeys.keyData is invalid. Here are a few things you can check:

    Correct Path: Ensure that the path to your public key is correct. It should be ~/.ssh/authorized_keys (note the plural keys).

    Public Key Content: Verify that the content of the public key file is correct. You can do this by running:

    cat ~/.ssh/authorized_keys

    The output should start with ssh-rsa followed by the key.

    Parameter Value: Make sure you are passing the actual content of the public key, not the path to the file. You can update your command like this:

    az deployment group create -n -g --template-file ./marinerazuredeploy.json --parameters projectName= adminUsername=bob adminPublicKey=
    

    Key Format: Ensure that the key is in the correct format. Sometimes, extra spaces or newlines can cause issues.

    Try these steps and see if they resolve the issue. If you still encounter problems, feel free to share more details!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.