In my previous articles (listed below), we have discussed creating the App Service and deploying the Web App using Visual Studio.
- Azure App Service: Create Web App from Visual Studio
- Azure App Service: Configure Existing Application From Visual Studio
However, we didn’t discuss much about the technique(s) behind the deployment of the code to Azure. Today, we will discuss about the possible ways of deploying the application to Azure along with different types of credentials that are available for deployment.
Let’s start with discussing the ways you can deploy the App Service application to Azure.
Below are the ways to deploy the code to an Azure App Service,
- Microsoft Web Deploy
Let’s now discuss about all the above different ways of deploying the application to Azure App Service.
- FTP (File Transfer Protocol)
This method is the most common traditional method of deploying the application’s Content – Source Code / Binary along with any other resources like Images / Videos etc. to the server on any hosting environment. We can deploy the codes literally related to any kind of technology. We just need to have a FTP client (like FileZilla etc.) to connect to the Server.
Below are the details about connecting to the Azure App Service WebApp using FileZilla (you can use any other FTP client for that matter).
You need to have the FTP URL, Username and Password for connecting to our App Service via FTP Client.
You can get the FTP details by navigating to the Settings as shown in the below screen capture.
Pick the FTP URL from the “FTP hostname”, Username from the “FTP/Deployment username and” the password. You need to enter the Password and click on the “Save” button.
Please note that the username will be in the <<Sitename>>\Username format. For example, if your App Service Web App name is “MyFirstAppServiceWebApp” and the username is “myuser” then you should use “MyFirstAppServiceWebApp\myuser” as the username in the FTP Clients. We will discuss more about these deployment credentials later in this article. Also, you should remember your password when you configure it as Azure will not display the password.
You can set the password in the “Set deployment credentials” blade of the above screen capture. Once you have all the required details ready, open the FileZilla client and fill all the details as shown below.
File Zilla – Create a Site – We need to create a site with-in FileZilla and provide all the FTP details as shown below.
That’s it. Click on “Connect” button and once you successfully connect to the FTP server, you will see something as shown below.
All our App service content is located under Site -> wwwroot folder as shown below.
You can now move all your code changes by copy pasting the content from your local machine to Azure using FileZilla.
- Microsoft Web Deploy
a.This is the easiest way for .NET developers using the great IDE Visual Studio. Please go through the article Azure App Service – Configure Existing Application From Visual Studio.
You now understand different ways of deploying the application to Azure App Service using the FTP Credentials. Let’s now discuss about different type of Credentials that we have in Azure.
Basically, there are two types of FTP Credentials.
- Account Level Credentials
a.These credentials are generic to all the Subscriptions associated to one given account (username with which you log into the Azure portal). So, if a given account say email@example.com is associated with multiple Subscriptions, then firstname.lastname@example.org can have just one FTP Username that will be associated with all the App Services across all the Subscriptions that are you have access to. However, while connecting to any App Service (say example.azurewebsites.net) your FTP Username would in the AppServiceName\username. So, in this case it would be example\username where username is the name given in the following FTP/deployment username as shown in the below screen capture.
Confused? Earlier I said, Account Level Credentials are common to all the App Services and now I am saying to prepend the AppService name in the FTPUsername “AppServiceName/Username”. Yes, here is what is mentioned in the Deployment Credentials blade.
Use this user name and password to deploy to any apps for all subscriptions associated with your Microsoft Azure account.
Though you append the App Service name to the FTP Username, it’s the same FTP Username for all the App Services for that account with the same password. So, please be sure when you want to change the password. If you change the password using the Deployment Credentials blade of a given App Service (as shown in the above screen capture) then it impacts all your connections of your existing FTP Servers of other App Services. It looks like a problem. Right? Don’t worry, here is the other type of FTP Credentials where you don’t want to have such impact, It’s Site Level Credentials.
Change Account Level Credentials
You can always change the credentials of the Account Level by navigating to the “Set Deployment Credentials” blade as shown the above screen capture.
- Site Level Credentials
These are specific to each App Service service. These credentials are automatically generated by the Azure portal. You can get these credentials by clicking on the “Get Publish Profile” button as shown the below screen capture.
Open the .PublishSettings file in Visual Studio on any text editor that you have downloaded by clicking on the “Get Publish Profile” button in the previous screen capture. You will see the Site Level Credentials as shown in the below screen capture. These are specific to individual App Service Service.
Please note that the password is NOT in the encrypted format. It’s actually in the clear text format. You need to use that string as it is while connecting to the FTP server (or even Web Deploy).
Change Site Level Password
You cannot change the long password for any string that you would like to remember. However, you can reset the password to some other long string by clicking on the “Reset Publish Profile”. Once you click you will get a confirmation alert as shown below.
Resetting the publish profile will invalidate all your previous published profiles of this App Service. So, please be sure before you click on Yes button of the above screen capture.