I'm using ARM templates to create azure resources for my project. One of the applications is .NET 5.0 Rest API deployed as App Service
with scheme as follows:
{
"apiVersion": "2020-06-01",
"name": "[variables('myWebsiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverFarms/', variables('hostingPlanName'))]",
"[resourceId('microsoft.insights/components/', variables('myWebsiteName'))]"
],
"tags": {
"environment": "[parameters('environment')]",
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('hostingPlanName'))]": "empty",
"displayName": "MyWebsite"
},
"properties": {
"name": "[variables('myWebsiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"siteConfig": {
"netFrameworkVersion": "v5.0",
"appSettings": [
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(concat('microsoft.insights/components/', variables('myWebsiteName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[reference(concat('microsoft.insights/components/', variables('myWebsiteName')), '2015-05-01').ConnectionString]"
},
{
"name": "ApplicationInsightsAgent_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "XDT_MicrosoftApplicationInsights_Mode",
"value": "default"
}
],
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnet"
}
]
}
}
}
For deploy I use ARM template deployment
task in incremental
mode in Azure DevOps
.
After I deploy ARM template I can successfuly deploy my application to App Service
and its working correctly.
The problem is that if I re-deploy the same ARM template
, then code from App Service
gets wiped out. There is no code on the server, and entering website address shows only this sentence:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
How can I deploy my ARM template so the App Service
stays intact if there weren't any changes in its template? It behaves correctly for another App Services, but this one always gets wiped out, even though ARM template
doesn't change.