我已经成功创建并发布了版本,并将我的React应用程序部署在Azure Web App环境中。我创建的应用程序将部署在许多不同的客户环境中,并且我不想自己创建每个应用程序服务,因此我想使该过程自动化。我已经导出了模板,现在有一个deploy.psh1
文件和一个parameters.json
和一个template.json
文件。但是我不确定现在该怎么办。
我尝试在发布步骤中添加powershell task
,并在内联部分粘贴deploy.sh1
的内容,但这会导致多个错误:
2019-05-30T19:16:31.9475172Z ##[section]Starting: PowerShell Script
2019-05-30T19:16:31.9534016Z ==============================================================================
2019-05-30T19:16:31.9534117Z Task : PowerShell
2019-05-30T19:16:31.9534203Z Description : Run a PowerShell script on Windows, macOS, or Linux.
2019-05-30T19:16:31.9534274Z Version : 2.148.0
2019-05-30T19:16:31.9534351Z Author : Microsoft Corporation
2019-05-30T19:16:31.9534429Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613736)
2019-05-30T19:16:31.9534519Z ==============================================================================
2019-05-30T19:16:32.8910231Z Generating script.
2019-05-30T19:16:32.9442109Z ========================== Starting Command Output ===========================
2019-05-30T19:16:32.9667917Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\c37bf4b5-41a1-4125-b7c3-04e0c77fe403.ps1'"
2019-05-30T19:16:33.2330921Z At C:\agent\_work\_temp\c37bf4b5-41a1-4125-b7c3-04e0c77fe403.ps1:30 char:10
2019-05-30T19:16:33.2331159Z + [string]
2019-05-30T19:16:33.2331234Z + ~
2019-05-30T19:16:33.2331512Z Missing closing ')' in expression.
2019-05-30T19:16:33.2332867Z At C:\agent\_work\_temp\c37bf4b5-41a1-4125-b7c3-04e0c77fe403.ps1:49 char:1
2019-05-30T19:16:33.2333119Z + )
2019-05-30T19:16:33.2333839Z + ~
2019-05-30T19:16:33.2334117Z Unexpected token ')' in expression or statement.
2019-05-30T19:16:33.2335145Z At C:\agent\_work\_temp\c37bf4b5-41a1-4125-b7c3-04e0c77fe403.ps1:29 char:2
2019-05-30T19:16:33.2335362Z + [Parameter(Mandatory=$True)]
2019-05-30T19:16:33.2336143Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-05-30T19:16:33.2336345Z Unexpected attribute 'Parameter'.
2019-05-30T19:16:33.2337371Z At C:\agent\_work\_temp\c37bf4b5-41a1-4125-b7c3-04e0c77fe403.ps1:40 char:2
2019-05-30T19:16:33.2337639Z + [Parameter(Mandatory=$True)]
2019-05-30T19:16:33.2338286Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-05-30T19:16:33.2338534Z Unexpected attribute 'Parameter'.
2019-05-30T19:16:33.2339929Z + CategoryInfo : ParserError: (:) [], ParseException
2019-05-30T19:16:33.2340251Z + FullyQualifiedErrorId : MissingEndParenthesisInExpression
2019-05-30T19:16:33.2340819Z
2019-05-30T19:16:33.3687310Z ##[error]PowerShell exited with code '1'.
2019-05-30T19:16:33.3968831Z ##[section]Finishing: PowerShell Script
所以我的问题是如何在发布期间添加app-service
的创建?
答案 0 :(得分:0)
有一个资源组部署任务,可直接用于部署ARM模板:https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops
它将您的parameter.json和template.json作为输入。