ARM 模板部署失败(没有为“/MSDeploy”注册路由)
ARM Template deployment fails (No route registered for '/MSDeploy')
我尝试从 Visual Studio 2019 将我的资源组部署到 Azure。部署失败并出现以下错误。
00:14:13 - Template deployment returned the following errors:
00:14:13 - 12:14:07 AM - Resource Microsoft.Web/sites/extensions 'azapp-mentoringdemo-020/MSDeploy' failed with message '{
00:14:13 - "error": {
00:14:13 - "code": "BadRequest",
00:14:13 - "message": "No route registered for '/MSDeploy'"
00:14:13 - }
00:14:13 - }
重要说明: 只有当我部署到 Linux 应用服务时才会发生这种情况。 Linux 应用服务似乎无法使用扩展程序。因为这在门户网站上被禁用。
我的长ARM模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"target_env": {
"type": "string",
"allowedValues": [ "dev", "stage", "prod" ],
"defaultValue": "dev",
"metadata": {
"description": "Target Environment (possible values: dev, stage and prod)."
}
},
"azapp_name": {
"defaultValue": "azapp-mentoringdemo-001",
"type": "String",
"metadata": {
"description": "App Service name."
}
},
"azplan_name": {
"defaultValue": "azplan-mentoringdemo-001",
"type": "String",
"metadata": {
"description": "Service Plan name."
}
},
"_artifactsLocation": {
"type": "string"
},
"_artifactsLocationSasToken": {
"type": "securestring"
},
"AzureMentoring.WebAppPackageFolder": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "WebDeploy package location. This path is relative to the _artifactsLocation parameter"
}
},
"AzureMentoring.WebAppPackageFileName": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Name of the webdeploy package"
}
}
},
"variables": {},
"resources": [
// Service Plan with sku which supports slots
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[parameters('azplan_name')]",
"location": "North Europe",
"sku": {
"name": "P1v2",
"tier": "PremiumV2",
"size": "P1v2",
"family": "Pv2",
"capacity": 1
},
"kind": "linux",
"properties": {
"perSiteScaling": false,
"maximumElasticWorkerCount": 1,
"isSpot": false,
"reserved": true,
"isXenon": false,
"hyperV": false,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0
}
},
// the App service
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('azapp_name')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "[concat(parameters('azapp_name'), '.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "[concat(parameters('azapp_name'), '.scm.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Production Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'prod')]",
"name": "MSDeploy",
"apiVersion": "2018-11-01",
"type": "extensions",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"tags": {
"displayName": "AzureMentoring.WebApp"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[parameters('azapp_name')]"
}
}
}
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
//"[resourceId('Microsoft.Web/Sites/Extensions', parameters('azapp_name'), 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/', parameters('azapp_name'), '.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp",
"hostNameType": "Verified"
}
},
// DEV slot
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]",
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "ivanovwebapp-dev.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "ivanovwebapp-dev.scm.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Development Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'dev')]",
"name": "MSDeploy",
"type": "Extensions",
"apiVersion": "2018-11-01",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]"
],
"tags": {
"displayName": "devMSDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[concat(parameters('azapp_name'), '/dev')]"
}
}
}
]
},
// STAGE slot
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]",
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "ivanovwebapp-stage.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "ivanovwebapp-stage.scm.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Staging Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'stage')]",
"name": "MSDeploy",
"type": "Extensions",
"apiVersion": "2018-11-01",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]"
],
"tags": {
"displayName": "stageMSDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[concat(parameters('azapp_name'), '/stage')]"
}
}
}
]
},
{
"type": "Microsoft.Web/sites/slots/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"//,
//"[resourceId('Microsoft.Web/Sites/Slots/Extensions', parameters('azapp_name'), 'dev', 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp__dev",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/slots/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"//,
//"[resourceId('Microsoft.Web/Sites/Slots/Extensions', parameters('azapp_name'), 'stage', 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp__stage",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/slots/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev/', parameters('azapp_name'), '-dev.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp(dev)",
"hostNameType": "Verified"
}
},
{
"type": "Microsoft.Web/sites/slots/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage/', parameters('azapp_name'), '-stage.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp(stage)",
"hostNameType": "Verified"
}
}
],
"outputs": {
// Значения имени среды (dev/stage/prod)
"target_env_name": {
"type": "string",
"value": "[parameters('target_env')]",
"metadata": {
"description": "Target Environment name."
}
},
// Полного доменного имени вашего приложения с учётом текущей среды
"target_env_app_url_prod": {
"condition": "[equals(parameters('target_env'), 'prod')]",
"type": "string",
"value": "[concat('http://', parameters('azapp_name'), '-', parameters('target_env'), '.azurewebsites.net')]",
"metadata": {
"description": "Target Environment web site url(concat result)."
}
},
"target_env_app_url": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "string",
"value": "[concat('http://', parameters('azapp_name'), '-', parameters('target_env'), '.azurewebsites.net')]",
"metadata": {
"description": "Target Environment web site url(concat result)."
}
},
"target_env_real_app_url": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "array",
"value": "[reference(resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), parameters('target_env'))).HostNames]",
"metadata": {
"description": "Target Environment web site url(reference result)."
}
},
// Публичный IP-адрес текущей среды
//
// https://docs.microsoft.com/ru-ru/azure/app-service/overview-inbound-outbound-ips
"target_env_pip": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "string",
// https://docs.microsoft.com/ru-ru/azure/azure-resource-manager/templates/template-functions-resource#resourceid
"value": "[reference(resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), parameters('target_env'))).OutboundIpAddresses]",
"metadata": {
"description": "Public IP Addresses of Target Environment."
}
}
}
}
根据名称 MSDeploy,我认为此扩展适用于 Microsoft,例如。 Windows 服务器,不适用于 Linux。 Linux 和 Windows 都有许多扩展名,但它们通常是不同的扩展名。因此,您需要搜索该扩展的 Linux 版本才能使其正常工作。
要获取某个地区的所有可用扩展程序,您可以这样做:
Get-AzVMImagePublisher -Location "West US" | Get-AzVMExtensionImageType | Get-AzVMExtensionImage | select PublisherName, Type, Version
我尝试从 Visual Studio 2019 将我的资源组部署到 Azure。部署失败并出现以下错误。
00:14:13 - Template deployment returned the following errors:
00:14:13 - 12:14:07 AM - Resource Microsoft.Web/sites/extensions 'azapp-mentoringdemo-020/MSDeploy' failed with message '{
00:14:13 - "error": {
00:14:13 - "code": "BadRequest",
00:14:13 - "message": "No route registered for '/MSDeploy'"
00:14:13 - }
00:14:13 - }
重要说明: 只有当我部署到 Linux 应用服务时才会发生这种情况。 Linux 应用服务似乎无法使用扩展程序。因为这在门户网站上被禁用。
我的长ARM模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"target_env": {
"type": "string",
"allowedValues": [ "dev", "stage", "prod" ],
"defaultValue": "dev",
"metadata": {
"description": "Target Environment (possible values: dev, stage and prod)."
}
},
"azapp_name": {
"defaultValue": "azapp-mentoringdemo-001",
"type": "String",
"metadata": {
"description": "App Service name."
}
},
"azplan_name": {
"defaultValue": "azplan-mentoringdemo-001",
"type": "String",
"metadata": {
"description": "Service Plan name."
}
},
"_artifactsLocation": {
"type": "string"
},
"_artifactsLocationSasToken": {
"type": "securestring"
},
"AzureMentoring.WebAppPackageFolder": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "WebDeploy package location. This path is relative to the _artifactsLocation parameter"
}
},
"AzureMentoring.WebAppPackageFileName": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Name of the webdeploy package"
}
}
},
"variables": {},
"resources": [
// Service Plan with sku which supports slots
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[parameters('azplan_name')]",
"location": "North Europe",
"sku": {
"name": "P1v2",
"tier": "PremiumV2",
"size": "P1v2",
"family": "Pv2",
"capacity": 1
},
"kind": "linux",
"properties": {
"perSiteScaling": false,
"maximumElasticWorkerCount": 1,
"isSpot": false,
"reserved": true,
"isXenon": false,
"hyperV": false,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0
}
},
// the App service
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('azapp_name')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "[concat(parameters('azapp_name'), '.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "[concat(parameters('azapp_name'), '.scm.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Production Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'prod')]",
"name": "MSDeploy",
"apiVersion": "2018-11-01",
"type": "extensions",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"tags": {
"displayName": "AzureMentoring.WebApp"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[parameters('azapp_name')]"
}
}
}
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
//"[resourceId('Microsoft.Web/Sites/Extensions', parameters('azapp_name'), 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/', parameters('azapp_name'), '.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp",
"hostNameType": "Verified"
}
},
// DEV slot
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]",
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "ivanovwebapp-dev.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "ivanovwebapp-dev.scm.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Development Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'dev')]",
"name": "MSDeploy",
"type": "Extensions",
"apiVersion": "2018-11-01",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]"
],
"tags": {
"displayName": "devMSDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[concat(parameters('azapp_name'), '/dev')]"
}
}
}
]
},
// STAGE slot
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]",
"[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]"
],
"kind": "app,linux",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "ivanovwebapp-stage.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "ivanovwebapp-stage.scm.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('azplan_name'))]",
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
//appsettings
"appSettings": [
{
"name": "DEPLOYMENT_SLOT_NAME",
"value": "Staging Slot"
},
{
"name": "WEBSITE_WEBDEPLOY_USE_SCM",
"value": "false"
}
]
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
},
"resources": [
// MSDEPLOY
{
"condition": "[equals(parameters('target_env'), 'stage')]",
"name": "MSDeploy",
"type": "Extensions",
"apiVersion": "2018-11-01",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]"
],
"tags": {
"displayName": "stageMSDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('AzureMentoring.WebAppPackageFolder'), '/', parameters('AzureMentoring.WebAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[concat(parameters('azapp_name'), '/stage')]"
}
}
}
]
},
{
"type": "Microsoft.Web/sites/slots/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"//,
//"[resourceId('Microsoft.Web/Sites/Slots/Extensions', parameters('azapp_name'), 'dev', 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp__dev",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/slots/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"//,
//"[resourceId('Microsoft.Web/Sites/Slots/Extensions', parameters('azapp_name'), 'stage', 'MSDeploy')]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"linuxFxVersion": "DOTNETCORE|3.1",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$ivanovwebapp__stage",
"azureStorageAccounts": {},
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"appCommandLine": "dotnet /home/site/wwwroot/AzureMentoring.WebApp.dll",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/slots/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/dev/', parameters('azapp_name'), '-dev.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'dev')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp(dev)",
"hostNameType": "Verified"
}
},
{
"type": "Microsoft.Web/sites/slots/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('azapp_name'), '/stage/', parameters('azapp_name'), '-stage.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), 'stage')]",
"[resourceId('Microsoft.Web/sites', parameters('azapp_name'))]"
],
"properties": {
"siteName": "ivanovwebapp(stage)",
"hostNameType": "Verified"
}
}
],
"outputs": {
// Значения имени среды (dev/stage/prod)
"target_env_name": {
"type": "string",
"value": "[parameters('target_env')]",
"metadata": {
"description": "Target Environment name."
}
},
// Полного доменного имени вашего приложения с учётом текущей среды
"target_env_app_url_prod": {
"condition": "[equals(parameters('target_env'), 'prod')]",
"type": "string",
"value": "[concat('http://', parameters('azapp_name'), '-', parameters('target_env'), '.azurewebsites.net')]",
"metadata": {
"description": "Target Environment web site url(concat result)."
}
},
"target_env_app_url": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "string",
"value": "[concat('http://', parameters('azapp_name'), '-', parameters('target_env'), '.azurewebsites.net')]",
"metadata": {
"description": "Target Environment web site url(concat result)."
}
},
"target_env_real_app_url": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "array",
"value": "[reference(resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), parameters('target_env'))).HostNames]",
"metadata": {
"description": "Target Environment web site url(reference result)."
}
},
// Публичный IP-адрес текущей среды
//
// https://docs.microsoft.com/ru-ru/azure/app-service/overview-inbound-outbound-ips
"target_env_pip": {
"condition": "[or(equals(parameters('target_env'), 'dev'), equals(parameters('target_env'), 'stage'))]",
"type": "string",
// https://docs.microsoft.com/ru-ru/azure/azure-resource-manager/templates/template-functions-resource#resourceid
"value": "[reference(resourceId('Microsoft.Web/sites/slots', parameters('azapp_name'), parameters('target_env'))).OutboundIpAddresses]",
"metadata": {
"description": "Public IP Addresses of Target Environment."
}
}
}
}
根据名称 MSDeploy,我认为此扩展适用于 Microsoft,例如。 Windows 服务器,不适用于 Linux。 Linux 和 Windows 都有许多扩展名,但它们通常是不同的扩展名。因此,您需要搜索该扩展的 Linux 版本才能使其正常工作。
要获取某个地区的所有可用扩展程序,您可以这样做:
Get-AzVMImagePublisher -Location "West US" | Get-AzVMExtensionImageType | Get-AzVMExtensionImage | select PublisherName, Type, Version