Forum Discussion

GirishPrabhudesai's avatar
GirishPrabhudesai
Copper Contributor
Oct 07, 2024
Solved

Azure powershell Set-AzStorageLocalUser - how to use existing ssh key in azure?

I am trying to build powershell script to create a local user for sftp in the Azure Stroage account. We have ssh keys already created in Azure. When the local user is created, existing ssh key c...
  • balasubramanim's avatar
    balasubramanim
    Oct 08, 2024

    GirishPrabhudesai 

     

    Please try these steps.


    1. Get the SSH Key: You need to manually retrieve the SSH key from Azure.
    2. Base64 Encode the Key: Convert the SSH key into Base64 format to ensure it's properly formatted.
    3. Use the Key: Finally, use the Set-AzStorageLocalUser command to assign the SSH key to your new local user.

     

    There is no built-in PowerShell command to directly pull and assign an existing SSH key automatically like you can in the Azure Portal. You have to handle it in these steps.

     

    Reference URL: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/mac-create-ssh-keys

     

    Many Thanks

    Balasubramani.M

Resources