[Azure] How to publish with Visual Studio to Azure


I`ve saw some documentation on this topic that was outdated, so I will make a short lists of steps that apply now in order to get you visual studio linked to visual studio by importing the publishing profile from your azure subscription. That way you can publish web apps or other directly from Visual Studio or WebMatrix to Azure.

The old way (does not work anymore)

1. Download the Azure PowerShell modules by running the Microsoft Web Platform Installer.  The Web Platform Installer installs the Azure PowerShell modules and all dependencies. Follow the prompts to complete the installation.

If this is not installed, you cannot run any Azure Powershell cmdlets and you will get exceptions like:

Get-AzurePublishSettingsFile : The term 'Get-AzurePublishSettingsFile' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ Get-AzurePublishSettingsFile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-AzurePublishSettingsFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

2. If this is installed however, you can search after the windows azure powershell and launch it with administrator rights:

3. Login to portal.azure.com and launch the Azure portal by clicking on your profile->Azure portal and this will redirect you. Or login to https://manage.windowsazure.com

4. Execute the following powershell script in the opened windows azure powershell


5. Import the publishing profile file into Visual Studio. With Visual Studio 2013 it will however say the profile is invalid.


A more simpler approach is to update Visual Studio 2013 to Update 4. https://www.microsoft.com/en-us/download/details.aspx?id=44921

This will change the wizard for the import of the azure publisher profile.

So now when you click publish on your web application, you can specify the profile directly from Visual Studio:

Select a publish target-> Microsoft Azure Websites-> and you will be logged into your azure profile.

After a successful login, the connection can be tested and you even get a preview for your website.