如何使用PowerShell部署到Azure App Service?

Iro*_*ash 4 powershell azure azure-web-sites

我环顾四周,在PowerShell中的Azure和AzureRM Commandlet中有成千上万的命令,但我仍然不确定如何执行此操作。

到目前为止,我的工作是:

  • 安装Azure和AzureRM模块并将其导入脚本
  • 通过get-AzurePublishSettingsFile命令生成了“ * .publishsettings”文件
  • 导入了“ * .publishsettings”文件
  • 可以使用“ Stop-AzureWebsite”和“ Start-AzureWebsite”命令行访问该网站

我需要做什么:

  • 创建一个新的部署并将文件推送到应用程序服务站点。

注意:我没有Visual Studio项目和.csproj文件配置。我只想获取文件夹的内容并将其推送到网站。

任何帮助都是有用的,因为该文档确实对细节不利,并且PowerShell中有成千上万的命令需要经过。

Shu*_*bao 6

您可以查看此博客:使用Azure PowerShell将应用程序服务部署到部署槽

Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile .\Your-Publish-Settings-credentials.publishsettings
Get-AzureSubscription
Select-AzureSubscription -SubscriptionName "The Subscription Name containing the slot"
Set-AzureSubscription -SubscriptionId "ID of subscription"

$WebAppName = "standard(staging)"
Get-AzureWebsite -Name $WebAppName
Publish-AzureWebsiteProject -Name $WebAppName -Package "C:\PowerShell\standard.zip" -Slot "staging"
Run Code Online (Sandbox Code Playgroud)