Resetting publishing profile password

September 30th 2022 Visual Studio Azure

When you create a publish profile in Visual Studio, the password for accessing the target Azure service is also stored. However, if this password changes in Azure or if you retrieve the publish profile from source control so that there is no valid password stored in your copy of Visual Studio, you must enter the password during publishing. Where can you find the valid password and how can you store it again in Visual Studio?

If you want to publish your application to Azure App Service from Visual Studio, you do not necessarily need access to that Azure account. You just need the corresponding *.PublishSettings file, which you can download from the Azure Portal. There is a Get publish profile button for this in the toolbar of the App Service Overview page:

App Service Overview page toolbar

To import the file into Visual Studio, open the Publish window for the project and launch the wizard for creating a new publish profile. Select the Import Profile option and choose the downloaded *.PublishSettings file.

Import profile into Visual Studio

This generates a valid publish profile that you can use to deploy the project to the App Service without entering a password or other credentials.

To share the profile with other developers, you can commit files that Visual Studio created in the PublishProfiles and ServiceDependencies subfolders to your project repository. When someone retrieves these files from source control, the publish profiles are already available to them.

However, when they try to run this profile, they are greeted with a dialog to enter the password:

Password dialog

The requested password can be found in the Azure Portal. You need to navigate to the Deployment Center page of your App Service and open the FTPS credentials tab. You can copy the Password from the Application scope section. The corresponding Username should match the username in the password dialog displayed by Visual Studio.

App Service Deployment Center page

If you enter this password in the dialog, publishing will proceed and be successful. Unfortunately, Visual Studio does not store the password anywhere. So, the next time you run the profile, you will have to enter the password again.

If you want to avoid this, you need to open the profile for editing. In the wizard, go to the Connection page and fill in the Password field. Make sure that the Save password check box is selected and click Save. From now on you can run the publish profile without entering the password again.

Edit publish profile in Visual Studio

If you need to enter the password when you run a publish profile for an Azure App Service, you can find it in the Azure Portal. To save it permanently in Visual Studio, you need to edit the profile and insert it there rather than in the password dialog that appears when you run the profile.

Get notified when a new blog post is published (usually every Friday):

If you're looking for online one-on-one mentorship on a related topic, you can find me on Codementor.
If you need a team of experienced software engineers to help you with a project, contact us at Razum.
Copyright
Creative Commons License