smwikipedia
smwikipedia

Reputation: 64173

How to publish an Azure web site (xxx.azurewebsites.net) with PowerShell?

I have my web site built ready in a folder. And I know how to use Azure PowerShell to create a site.

In Azure management portal, I just need to copy the site files through FTP.

But I don't know how to use PowerShell to push my web site files to Azure. Could someone shed some light?

Upvotes: 3

Views: 2133

Answers (1)

Rick Rainey
Rick Rainey

Reputation: 11246

You can use the Publish-AzureWebsiteProject cmdlet to do this.

For example, suppose you have your Azure Website already created at contosows.azurewebsites.net. On your local computer running Visual Studio 2013, publish your web application as a Web Deploy Package and give it a name, such as Contoso.WebSite.zip.

enter image description here

Now, in PowerShell, run this command

Publish-AzureWebsiteProject -Package .\Contoso.Website.zip -Name contosows

In a few short seconds, you will be able to launch your site at http://contosows.azurewebsites.net.

If you want to automate the creation of the package (.zip) so you don't have to use Visual Studio, then you could use MSBuild.exe to create the package. Note: See the image above to see where I got the value for the Configuration parameter. For example...

msbuild "Contoso.Website.csproj" /T:Package /P:Configuration=ContosoWebsite;OutputPath=[PATH TO PLACE PACKAGE IN]

Upvotes: 7

Related Questions