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

守給你的承諾、 提交于 2019-12-07 23:10:19

问题


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?


回答1:


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.

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]


来源:https://stackoverflow.com/questions/25290831/how-to-publish-an-azure-web-site-xxx-azurewebsites-net-with-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!