Publish Azure Website to non-root folder from Powe

2020-03-30 02:32发布

I'm testing my assumptions at the moment. I have my Asp.Net MVC application located at www.myapp.com/app and a third-party CMS system on www.myapp.com/.

The web-site is set up like described in this answer

At the moment I can publish both of the applications separately and manually from Visual Studio and it works fine.

However, I'm trying to publish my application from a build server where I'm using Azure Power-Shell scriplets:

PS> Publish-AzureWebsiteProject -Name myApp -Package MyWebDeployPackage.zip

However, documentation does not mention if you can publish with this scriplet to a non-root folder.

Any way I can publish an application to ~/app from a command line?

UPD: I can publish from msbuild via

msbuild .\SolutionName.sln /p:DeployOnBuild=true /p:PublishProfile=ProfileName /p:Password=passwordForAzurePublishing /p:AllowUntrustedCertificate=true

Where ProfileName is a web-deploy profile configured to deploy to sub-folder of Azure Web-Site and Password is deployment password from Azure profile.

However this is not an optimal solution: to deploy to test and to production environment, I need to build the application twice, which I'd like to avoid: if I compile views, it takes 7-10 minutes (we have 800 views). Doing this twice is a waste of time.

UPD 2: Created an issue on Azure SDK Tools repository: https://github.com/Azure/azure-sdk-tools/issues/2667

1条回答
地球回转人心会变
2楼-- · 2020-03-30 03:11

I don't think this is possible from PowerShell, but I might be mistaken. Looking at their publish code here https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1136-L1168

and also here https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1218-L1229

they don't have a parameter for the app name, and the code in the second link builds the site name/slot manually.

I would say open an issue here https://github.com/Azure/azure-sdk-tools/issues for this and somebody from the Azure PowerShell team should look at it.

查看更多
登录 后发表回答