Azure app service SSH Key for deployment



I follow this link to perform GitLab CI/CD deployment.

And I use this link get the token.

Everything is okay, but some time the SSH key that generated above did not work, so I have to go to the link above to generated again.

I use to SSH and check .ssh folder but not exist in /root.

I notice that two strange folders that contain .ssh folder itself as below

User's image

User's image

So, what are these folders?

What can I do to keep my SSH key persistent?

Thank you!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,135 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sedat SALMAN 13,185 Reputation points

    Depending on your specific application, you may encounter additional randomly named folders that store temporary files, caches, or other runtime-specific data.

    In Azure App Service, the SSH key generated for deployment is stored in a temporary file system, which means it may not persist across app restarts or scale-out operations.

    • Generate an SSH key pair: Generate an SSH key pair locally using a tool like ssh-keygen if you haven't already.
    • Configure SSH for Azure App Service: In the Azure portal, go to your App Service, navigate to the "Configuration" blade, and scroll down to the "SSH" section. Add an app setting called WEBSITE_SSH_PUBLIC_KEY and paste the contents of your SSH public key file into the value field. Save the configuration.
    • Deploy the SSH key: When you deploy your application to Azure App Service, the SSH public key will be injected into the app environment, making it available for SSH access.
    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful