Friday, July 20, 2018

Deploy your site to Azure App service from Visual Studio

Building your website and publishing it i Azure app service is simpler than publishing the site into a remote machine. There are several methods through which you can publish your site into Azure.

Import publisher file:


This is one of the easiest way t publish your site in Azure app service. First off all create a new app service or if you have an existing one,  open the Overview section of that.
You will find several options on the top of the Overview sections like Browse, Stop, Swap etc. There will be another one named Get Publish Profile. By clicking on that link a new file will be downloaded with .PublishSettings extension.

If you open the file in any text editor, you will find that, it is nothing but a XML file having 2 tags. One for web deployment and another for FTP deployment with your app name. Within that your will also find all the credential for your deployment. Both for FTP and web deploy. But as usual all password will be decrypted so it is harmless.
<publishProfile profileName=" - Web Deploy" 
                 publishMethod="MSDeploy" 
                 publishUrl=".scm.azurewebsites.net:443" 
                 msdeploySite="" 
                 userName="" 
                 userPWD="" 
                 destinationAppUrl="" 
                 SQLServerDBConnectionString="" 
                 mySQLDBConnectionString="" 
                 hostingProviderForumLink="" 
                 controlPanelLink="http://windows.azure.com" 
                 webSystem="WebSites">


 <publishProfile profileName=" - FTP" 
                 publishMethod="FTP" 
                 publishUrl="/site/wwwroot" 
                 ftpPassiveMode="True" 
                 userName="" 
                 userPWD="" 
                 destinationAppUrl="" 
                 SQLServerDBConnectionString="" 
                 mySQLDBConnectionString="" 
                 hostingProviderForumLink="" 
                 controlPanelLink="http://windows.azure.com" 
                 webSystem="WebSites">
Now open your Visual Studio IDE and create a new application. In case you have already created it go to the solution. Right click on the solution -> Click the publish option to open the publish dialog.
Now in the publish dialog you will find an option named “Import”. Click on that option and a File dialog will be opened. Choose your file and click OK. After clicking OK it will automatically redirect to Connection tab in Publish web window.



Now you can choose either Web deploy or FTP from the drop down over there. For both all the fields will be pre populated with all the informations and credentials.

Click on the Validate connection and check our connections from Visual Studio.
Click Next to choose configuration parts. Choose either Debug or Release, whatever is suitable for your applications. You can also manage File publish options from here.
Again click on the Next to go to the Preview section. Click on the Start Preview button if you want to see the files are going to push into the server. Or click Publish (Keyboard: P) to publish the site into your app server.
After successful deployment site will be open automatically in your default browser.
FTP deployment:
There is another quick method to deploy your site into Azure app service through FTP. Go to the Overview section of your app service. In the first section right side you will find the details of FTP connections. Usernames, FTP hostname, FTPS hostname. Password for this deployment will your own account password.
Go to the Visual studio and right click on the solution. Click the publish option and create a new publisher profile. Choose FTP in the Connection tab from Publish method drop down list.
Server: FTP hostname/ FTPS hostnameSite Path: site/wwwroot (Check the passive mode)User name: FTP/deployment usernamePassword: Your account passwordDestination URL: Your site URL


Click on the Validate button to validate your enter details and connection. Click on the publish button to publish your site. After successful publish, site will be open in your default browser automatically. 

Popular Posts

Pageviews