Azure app service SSH Key for deployment

Anonymous
2023-05-11T09:39:22.9466667+00:00

Hi,

I follow this link https://blog.brooksjc.com/2018/12/27/gitlab-continuous-ci-cd-with-an-azure-web-app/ to perform GitLab CI/CD deployment.

And I use this link https://myappname.scm.azurewebsites.net/api/sshkey?ensurePublicKey=1 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 https://myappname.scm.azurewebsites.net/webssh/host 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,408 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sedat SALMAN 13,345 Reputation points
    2023-05-13T14:35:36.2+00:00

    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