Ниже приведен шаблон ARM, который я использую для создания службы приложений и использования частного репозитория GitHub для развертывания приложений со сбоями развертывания для приложений.
{
"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",
"apiVersion": "2020-06-01",
"name": "[parameters(\'siteName\')]",
"location": "[parameters(\'location\')]",
"identity": {
"type": "SystemAssigned"
},
"dependsOn": [
"[resourceId(\'Microsoft.Web/serverfarms\', variables(\'hostingPlanName\'))]"
],
"properties": {
"serverFarmId": "[variables(\'hostingPlanName\')]"
},
"resources": [
{
"type": "sourcecontrols",
"apiVersion": "2020-06-01",
"name": "web",
"location": "[parameters(\'location\')]",
"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:[email protected]/trouble1fake/uploadfile"
},
"sku": {
"value": "B1"
},
"workerSize": {
"value": "0"
},
"branch": {
"value": "master"
}
}
}
}
}
Я использую repoUrl https://trouble1fake:[email protected]/trouble1fake/uploadfile.
Все еще не работает. Или я могу выполнять команды или импортировать файлы, используя API отдыха?
Это не так. Вы должны сначала создать артефакты своего решения GitHub, а затем развернуть его (будь то локальное или конвейерное). Пожалуйста, обратитесь к приведенным ниже подходам и выберите тот, который вы хотите:
Вы можете использовать Visual Studio
для развертывания своего приложения, как только оно будет клонировано в вашем локальном хранилище из вашего частного репозитория: Разверните веб-приложение ASP.NET в службе приложений Azure
Вы можете развернуть свое приложение с помощью конвейеров Azure DevOps, при этом вы можете добавить свой код на сервер ADO и выполнить пошаговый процесс развертывания приложения: Развертывание в службе приложений Azure с помощью конвейера Azure DevOps CI/CD.