如何解决如何使用 REST API 或 ARM 模板在具有私有 GitHub 存储库的应用服务中部署应用?
以下是我用来创建应用服务并使用私有 GitHub 存储库部署应用程序的 ARM 模板,但应用程序部署失败。
{
"properties": {
"mode": "Incremental","template":{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#","contentVersion": "1.0.0.1","parameters": {
"siteName": {
"type": "string","defaultValue": "[concat(\'WebApp-\',uniqueString(resourceGroup().id))]","Metadata": {
"description": "The name of you Web Site."
}
},"location": {
"type": "string","defaultValue": "[resourceGroup().location]","Metadata": {
"description": "Location for all resources."
}
},"sku": {
"type": "string","allowedValues": [
"F1","D1","B1","B2","B3","S1","S2","S3","P1","P2","P3","P4"
],"defaultValue": "F1","Metadata": {
"description": "The pricing tier for the hosting plan."
}
},"workerSize": {
"type": "string","allowedValues": [
"0","1","2"
],"defaultValue": "0","Metadata": {
"description": "The instance size of the hosting plan (small,medium,or large)."
}
},"repoURL": {
"type": "string","defaultValue": "https://github.com/Azure-Samples/app-service-web-html-get-started.git","Metadata": {
"description": "The URL for the GitHub repository that contains the project to deploy."
}
},"branch": {
"type": "string","defaultValue": "master","Metadata": {
"description": "The branch of the GitHub repository to use."
}
}
},"variables": {
"hostingPlanName": "jhyhfgljgljuhg-Plan"
},"resources": [
{
"type": "Microsoft.Web/serverfarms","apiVersion": "2020-06-01","name": "[variables(\'hostingPlanName\')]","location": "[parameters(\'location\')]","sku": {
"name": "[parameters(\'sku\')]","capacity": "[parameters(\'workerSize\')]"
},"properties": {
"name": "[variables(\'hostingPlanName\')]"
}
},{
"type": "Microsoft.Web/sites","name": "[parameters(\'siteName\')]","identity": {
"type": "SystemAssigned"
},"dependsOn": [
"[resourceId(\'Microsoft.Web/serverfarms\',variables(\'hostingPlanName\'))]"
],"properties": {
"serverFarmId": "[variables(\'hostingPlanName\')]"
},"resources": [
{
"type": "sourcecontrols","name": "web","dependsOn": [
"[resourceId(\'Microsoft.Web/sites\',parameters(\'siteName\'))]"
],"properties": {
"repoUrl": "[parameters(\'repoURL\')]","branch": "[parameters(\'branch\')]","isManualIntegration": true,"ScmType":"Git"
}
}
]
}
]
},"parameters": {
"siteName": {
"value":"trouble1appservice"
},"repoUrl": {
"value":"https://trouble1fake:8f0276be40aaed284ac8862d198fb1e1a17f727f@github.com/trouble1fake/uploadfile"
},"sku": {
"value": "B1"
},"workerSize": {
"value": "0"
},"branch": {
"value": "master"
}
}
}
}
}
我使用的 repoUrl 是 https://trouble1fake:8f0276be40aaed284ac8862d198fb1e1a17f727f@github.com/trouble1fake/uploadfile
还是不行。 或者有什么方法可以使用rest api执行命令或导入文件?
解决方法
这不是它的工作方式。您必须先创建 GitHub 解决方案的工件,然后再部署它(无论是本地还是管道)。请参考以下方法并选择您想要的方法:
-
您可以使用
Visual Studio
部署您的应用程序,一旦它从您的私有存储库克隆到您的本地:Deploy an ASP.NET Web App in Azure App Service -
您可以使用 Azure DevOps 管道部署您的应用程序,您可以在其中将代码添加到 ADO 服务器中并按照分步流程部署应用程序:Deploying into Azure App Service using Azure DevOps CI/CD Pipeline强>.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。