簡體   English   中英

在Azure版本管道上使用部署腳本

[英]Use deploy script on Azure release pipeline

我已經創建了一個成功的構建和發布,它在Azure Web App環境中部署了我的React應用程序。 我創建的應用程序將部署在許多不同的客戶環境中,我不想自己創建每個應用程序服務,所以我想自動化該過程。 我已經導出了模板,現在我有一個帶有parameters.jsontemplate.json文件的deploy.psh1文件。 但我不確定現在要做什么。

我嘗試在我的發布步驟中添加一個powershell task ,並deploy.sh1聯部分粘貼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的創建?

有一個資源組部署任務,您可以直接使用它來部署ARM模板: https//docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view =天藍-DEVOPS

它將您的parameters.json和template.json作為輸入。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM