Answered by:
MSDeploy gives ThreadAbortException while running via Azure Resource Manager extensions

Question
-
Here's the log:
<entries> <entry time="2015-08-25T14:33:29.4536928+00:00" type="Message"> <message> Downloading metadata for package path 'simioportal-test-stageartifacts/SimioServerWebsiteAzure.zip' from blob 'https://simiodeploysupport.blob.core.windows.net' </message> </entry> <entry time="2015-08-25T14:33:29.6568238+00:00" type="Message"> <message> The blob has flag IsPremiumApp:. IsPremiumApp returns False </message> </entry> <entry time="2015-08-25T14:33:29.7378611Z" type="Message"> <message> Downloading package path 'simioportal-test-stageartifacts/SimioServerWebsiteAzure.zip' from blob 'https://simiodeploysupport.blob.core.windows.net' </message> </entry> <entry time="2015-08-25T14:33:31.4304478Z" type="Error"> <message>Failed to download package.</message> </entry> <entry time="2015-08-25T14:33:31.4619889Z" type="Error"> <message> AppGallery Deploy Failed: 'System.Threading.ThreadAbortException: Thread was being aborted.
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.Tasks.TaskAsyncResult`1.EndInvoke()
at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.EndImpl(IAsyncResult asyncResult)
at Microsoft.WindowsAzure.StorageClient.CloudBlob.EndDownloadToStream(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.<Download>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.<Download>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.DeploymentController.<DownloadAndDeployPackage>d__b.MoveNext()' </message> </entry> </entries>
Tuesday, August 25, 2015 5:55 PM
Answers
-
I think there is an known race condition issue when doing msdeploy after app settings or connection strings. Try doing msdeploy first, and then making both app settings and connection strings dependent on it.
David
- Marked as answer by Cory Crooks Wednesday, August 26, 2015 2:31 AM
Tuesday, August 25, 2015 8:46 PM -
I think it is the same issue as David suspected, in the other post I shared a template that does this (add MSDeploy as a dependency to other config/appsettings/connectionstring steps)
Thanks, Hosam
- Marked as answer by Cory Crooks Wednesday, August 26, 2015 2:31 AM
Tuesday, August 25, 2015 9:08 PM
All replies
-
Hello,
Please try Azure PowerShell with Azure Resource Manager to deploy and check.
https://azure.microsoft.com/en-in/documentation/articles/powershell-azure-resource-manager/
Regards DoD..
Tuesday, August 25, 2015 6:21 PM -
Right, exactly. I did use exactly that. A powershell deploy script relying on New-AzureResourceGroup with a passed in template file. Running that indicated that MSDeploy returned Failure, then hopping onto the scm companion website and looking at the LogFiles/SiteExtensions/MSDeploy/appManagerLog.xml is what I posted above.Tuesday, August 25, 2015 6:30 PM
-
Is this thread discussing the same issue as this one? If so, let's only keep one active to limit redundant investigation.
thanks,
DavidTuesday, August 25, 2015 7:20 PM -
Nope, two different issues. This one fails fast with an exception in the appManagerLog.xml file.
The other one never gets past logging that it downloaded the package metadata. The deployment then stalls until it hits its (hard-coded?) timeout of 2 hours or so, which when running from some continuous deployment scripts is ... disconcerting
Tuesday, August 25, 2015 7:46 PM -
For this issue, does it happen consistently? Can you share the ARM template that you are using?Tuesday, August 25, 2015 7:48 PM
-
Nope, it only happens some of the time.
Here's the template:
{ "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "deployType": { "type": "string", "allowedValues": [ "singleMachine", "multipleMachines" ] }, "hostPlanSKU": { "type": "string", "allowedValues": [ "Free", "Shared", "Basic", "Standard", "Premium" ], "defaultValue": "Standard" }, "hostPlanWorkerSize": { "type": "string", "allowedValues": [ "0", "1", "2" ], "defaultValue": "1" }, "sqlAdministratorLogin": { "type": "string" }, "sqlAdministratorLoginPassword": { "type": "securestring" }, "databaseName": { "type": "string", "defaultValue": "simioportaldb" }, "collation": { "type": "string", "defaultValue": "SQL_Latin1_General_CP1_CI_AS" }, "edition": { "type": "string", "defaultValue": "Standard" }, "maxSizeBytes": { "type": "string", "defaultValue": "1073741824" }, "requestedServiceObjectiveId": { "type": "string", "defaultValue": "f1173c43-91bd-4aaa-973c-54e79e15235b" // See https://msdn.microsoft.com/en-us/library/azure/Dn505723.aspx }, "storageAccountNameUnder23Chars": { "type": "string" }, "storageAccountType": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_GRS", "Standard_ZRS" ] }, "_artifactsLocation": { "type": "string" }, "_artifactsLocationSasToken": { "type": "securestring" }, "WebsiteDeployPackage": { "type": "string" }, "ExperimentRunnerDeployPackage": { "type": "string" }, "ReplicationRunnerDeployPackage": { "type": "string" }, "websiteSubDomain": { "type": "string", "defaultValue": "" }, "openIdClientId": { "type": "string" }, "sendGridPassword": { "type": "securestring" }, "allowHTTPAccess": { "type": "string", "defaultValue": "false" } }, "variables": { "environmentSettings": { "singleMachine": { "machineCount": 1, "machineNames": [ "web", "web", "web" ] // All web, so that if we later deploy with 3 different machines, we keep the existing web one... I think... }, "multipleMachines": { "machineCount": 3, "machineNames": [ "web", "exper", "repl" ] } }, "currentEnvironmentSettings": "[variables('environmentSettings')[parameters('deployType')]]", "machineCount": "[variables('currentEnvironmentSettings').machineCount]", "machineNames": "[variables('currentEnvironmentSettings').machineNames]", "namePrefix": "[resourceGroup().name]", // These must match the HostingPlan naming below "webHostingPlanName": "[concat(variables('namePrefix'),'-',variables('machineNames')[0])]", "experimentHostingPlanName": "[concat(variables('namePrefix'),'-',variables('machineNames')[1])]", "replicationHostingPlanName": "[concat(variables('namePrefix'),'-',variables('machineNames')[2])]", "webSiteName": "[concat(variables('namePrefix'),'-site-web')]", "experimentSiteName": "[concat(variables('namePrefix'),'-site-exper')]", "replicationSiteName": "[concat(variables('namePrefix'),'-site-repl')]", "sqlServerName": "[concat(variables('namePrefix'),'-sqlserver')]", "sqlServerNameStaging": "[concat(variables('namePrefix'),'-sqlserver-staging')]", "storageAccountName": "[parameters('storageAccountNameUnder23Chars')]", "storageAccountNameStaging": "[concat(parameters('storageAccountNameUnder23Chars'),'stg')]", "openIdAuthority": "https://login.windows.net/simio.onmicrosoft.com", "openIdRedirectUri": "[concat('https://www',parameters('websiteSubDomain'),'.simioportal.com/')]", "openIdCookieDomain": "[concat(parameters('websiteSubDomain'),'.simioportal.com')]", "openIdHostName": "www", "sendGridUserName": "azure_d76731e9dda51bf6aea3ce77f6da59af@azure.com", }, "resources": [ { "name": "[variables('sqlServerName')]", "type": "Microsoft.Sql/servers", "location": "[resourceGroup().location]", "tags": { "displayName": "SqlServer" }, "apiVersion": "2014-04-01-preview", "properties": { "administratorLogin": "[parameters('sqlAdministratorLogin')]", "administratorLoginPassword": "[parameters('sqlAdministratorLoginPassword')]" }, "resources": [ { "name": "[parameters('databaseName')]", "type": "databases", "location": "[resourceGroup().location]", "tags": { "displayName": "Database" }, "apiVersion": "2014-04-01-preview", "dependsOn": [ "[concat('Microsoft.Sql/servers/', variables('sqlServerName'))]" ], "properties": { "edition": "[parameters('edition')]", "collation": "[parameters('collation')]", "maxSizeBytes": "[parameters('maxSizeBytes')]", "requestedServiceObjectiveId": "[parameters('requestedServiceObjectiveId')]" } }, { "type": "firewallrules", "apiVersion": "2014-04-01-preview", "dependsOn": [ "[concat('Microsoft.Sql/servers/', variables('sqlServerName'))]" ], "location": "[resourceGroup().location]", "name": "AllowAllWindowsAzureIps", "properties": { "endIpAddress": "0.0.0.0", "startIpAddress": "0.0.0.0" } } ] }, { "name": "[variables('sqlServerNameStaging')]", "type": "Microsoft.Sql/servers", "location": "[resourceGroup().location]", "tags": { "displayName": "SqlServerStaging" }, "apiVersion": "2014-04-01-preview", "properties": { "administratorLogin": "[parameters('sqlAdministratorLogin')]", "administratorLoginPassword": "[parameters('sqlAdministratorLoginPassword')]" }, "resources": [ { "name": "[parameters('databaseName')]", "type": "databases", "location": "[resourceGroup().location]", "tags": { "displayName": "Database" }, "apiVersion": "2014-04-01-preview", "dependsOn": [ "[concat('Microsoft.Sql/servers/', variables('sqlServerNameStaging'))]" ], "properties": { "edition": "[parameters('edition')]", "collation": "[parameters('collation')]", "maxSizeBytes": "[parameters('maxSizeBytes')]", "requestedServiceObjectiveId": "[parameters('requestedServiceObjectiveId')]" } }, { "type": "firewallrules", "apiVersion": "2014-04-01-preview", "dependsOn": [ "[concat('Microsoft.Sql/servers/', variables('sqlServerNameStaging'))]" ], "location": "[resourceGroup().location]", "name": "AllowAllWindowsAzureIps", "properties": { "endIpAddress": "0.0.0.0", "startIpAddress": "0.0.0.0" } } ] }, { "apiVersion": "2015-04-01", "name": "[concat(variables('namePrefix'),'-',variables('machineNames')[copyIndex()])]", // This must match the definition of the *HostPlanName variables above "type": "Microsoft.Web/serverfarms", "location": "[resourceGroup().location]", "tags": { "displayName": "HostingPlan" }, "copy": { "name": "serverCopy", "count": "[variables('machineCount')]" }, "properties": { "name": "[concat(variables('namePrefix'),'-',variables('machineNames')[copyIndex()])]", // This must match the definition of the *HostPlanName variables above "sku": "[parameters('hostPlanSKU')]", "workerSize": "[parameters('hostPlanWorkerSize')]", "numberOfWorkers": 1 } }, { "apiVersion": "2014-06-01", "name": "[variables('webSiteName')]", "type": "Microsoft.Web/sites", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/serverFarms/', variables('webHostingPlanName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ], "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]": "empty", "displayName": "Website" }, "properties": { "name": "[variables('webSiteName')]", "serverFarm": "[variables('webHostingPlanName')]" }, "resources": [ // See https://github.com/davidebbo/AzureWebsitesSamples/blob/df4100cde76fc1f2f714cf2021b48f902e33040f/ARMTemplates/WebAppManyFeatures.json#L96-L120 { "apiVersion": "2014-11-01", "name": "connectionstrings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]" ], "properties": { "SimioServerDB": { "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlAdministratorLogin'), '@', variables('sqlServerName'), ';Password=', parameters('sqlAdministratorLoginPassword'), ';')]", "type": "SQLAzure" } } }, { "apiVersion": "2014-11-01", "name": "appsettings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]" ], "properties": { "AzureStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "ExperimentRunnerWebJobQueueStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "systemAdminOpenId:ClientId": "[parameters('openIdClientId')]", "systemAdminOpenId:Authority": "[variables('openIdAuthority')]", "systemAdminOpenId:LogoutRedirectURI": "[variables('openIdRedirectUri')]", "systemAdminOpenId:CookieDomain": "[variables('openIdCookieDomain')]", "systemAdminOpenId:hostname": "[variables('openIdHostName')]", "SendGrid_User": "[variables('sendGridUserName')]", "SendGrid_Pass": "[parameters('sendGridPassword')]", "AllowHTTPAccess": "[parameters('allowHTTPAccess')]" } }, { "apiVersion": "2015-04-01", "name": "slotconfignames", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]", "[resourceId('Microsoft.Web/Sites/Slots', variables('webSiteName'), 'Staging')]" ], "properties": { "appSettingNames": [ "AzureStorageAccountConnectionString", "ExperimentRunnerWebJobQueueStorageAccountConnectionString" ], "connectionStringNames": [ "SimioServerDB" ] } }, { "apiVersion": "2015-04-01", "name": "Staging", "type": "slots", "location": "[resourceGroup().location]", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]" ], "properties": { }, "resources": [ { "apiVersion": "2014-11-01", "name": "connectionstrings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites/Slots', variables('webSiteName'), 'Staging')]" ], "properties": { "SimioServerDB": { "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerNameStaging'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlAdministratorLogin'), '@', variables('sqlServerName'), ';Password=', parameters('sqlAdministratorLoginPassword'), ';')]", "type": "SQLAzure" } } }, { "apiVersion": "2014-11-01", "name": "appsettings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites/Slots', variables('webSiteName'), 'Staging')]" ], "properties": { "AzureStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountNameStaging'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameStaging')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "ExperimentRunnerWebJobQueueStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountNameStaging'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameStaging')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "systemAdminOpenId:ClientId": "[parameters('openIdClientId')]", "systemAdminOpenId:Authority": "[variables('openIdAuthority')]", "systemAdminOpenId:LogoutRedirectURI": "[variables('openIdRedirectUri')]", "systemAdminOpenId:CookieDomain": "[variables('openIdCookieDomain')]", "systemAdminOpenId:hostname": "[variables('openIdHostName')]", "SendGrid_User": "[variables('sendGridUserName')]", "SendGrid_Pass": "[parameters('sendGridPassword')]", "AllowHTTPAccess": "[parameters('allowHTTPAccess')]" } }, { "name": "MSDeploy", "type": "extensions", "location": "[resourceGroup().location]", "apiVersion": "2014-06-01", "dependsOn": [ "[resourceId('Microsoft.Web/Sites/Slots', variables('webSiteName'), 'Staging')]", "[resourceId('Microsoft.Web/Sites/Slots/config', variables('webSiteName'), 'Staging', 'appsettings')]" ], "tags": { "displayName": "WebsiteDeploy" }, "properties": { "packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('WebsiteDeployPackage'), parameters('_artifactsLocationSasToken'))]", "dbType": "None", "connectionString": "", "setParameters": { "IIS Web Application Name": "[variables('webSiteName')]" } } } ] } ] }, { "apiVersion": "2014-06-01", "name": "[variables('experimentSiteName')]", "type": "Microsoft.Web/sites", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/serverFarms/', variables('experimentHostingPlanName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ], "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('experimentHostingPlanName'))]": "empty", "displayName": "ExperimentRunnerSite" }, "properties": { "name": "[variables('experimentSiteName')]", "serverFarm": "[variables('experimentHostingPlanName')]" }, "resources": [ // See https://github.com/davidebbo/AzureWebsitesSamples/blob/df4100cde76fc1f2f714cf2021b48f902e33040f/ARMTemplates/WebAppManyFeatures.json#L96-L120 { "apiVersion": "2014-11-01", "name": "connectionstrings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('experimentSiteName'))]" ], "properties": { "SimioServerDB": { "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlAdministratorLogin'), '@', variables('sqlServerName'), ';Password=', parameters('sqlAdministratorLoginPassword'), ';')]", "type": "SQLAzure" }, "AzureWebJobsDashboard": { "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "type": "Custom" }, "AzureWebJobsStorage": { "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "type": "Custom" } } }, { "apiVersion": "2014-11-01", "name": "appsettings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('experimentSiteName'))]" ], "properties": { "AzureStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "ExperimentRunnerWebJobQueueStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]" } }, { "name": "MSDeploy", "type": "extensions", "location": "[resourceGroup().location]", "apiVersion": "2014-06-01", "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('experimentSiteName'))]", "[resourceId('Microsoft.Web/sites/config', variables('experimentSiteName'), 'appsettings')]", "[resourceId('Microsoft.Web/sites/config', variables('experimentSiteName'), 'connectionstrings')]" ], "tags": { "displayName": "ExperimentRunnerDeploy" }, "properties": { "packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('ExperimentRunnerDeployPackage'), parameters('_artifactsLocationSasToken'))]", "dbType": "None", "connectionString": "", "setParameters": { "IIS Web Application Name": "[variables('experimentSiteName')]" } } } ] }, { "apiVersion": "2014-06-01", "name": "[variables('replicationSiteName')]", "type": "Microsoft.Web/sites", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/serverFarms/', variables('replicationHostingPlanName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ], "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('replicationHostingPlanName'))]": "empty", "displayName": "ReplicationRunnerSite" }, "properties": { "name": "[variables('replicationSiteName')]", "serverFarm": "[variables('replicationHostingPlanName')]" }, "resources": [ // See https://github.com/davidebbo/AzureWebsitesSamples/blob/df4100cde76fc1f2f714cf2021b48f902e33040f/ARMTemplates/WebAppManyFeatures.json#L96-L120 { "apiVersion": "2014-11-01", "name": "connectionstrings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('replicationSiteName'))]" ], "properties": { "AzureWebJobsDashboard": { "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "type": "Custom" }, "AzureWebJobsStorage": { "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "type": "Custom" } } }, { "apiVersion": "2014-11-01", "name": "appsettings", "type": "config", "dependsOn": [ "[resourceId('Microsoft.Web/Sites', variables('replicationSiteName'))]" ], "properties": { "AzureStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]", "ExperimentRunnerWebJobQueueStorageAccountConnectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).key1)]" } }, { "name": "MSDeploy", "type": "extensions", "location": "[resourceGroup().location]", "apiVersion": "2014-06-01", "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('replicationSiteName'))]", "[resourceId('Microsoft.Web/sites/config', variables('replicationSiteName'), 'appsettings')]", "[resourceId('Microsoft.Web/sites/config', variables('replicationSiteName'), 'connectionstrings')]" ], "tags": { "displayName": "ReplicationRunnerDeploy" }, "properties": { "packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('ReplicationRunnerDeployPackage'), parameters('_artifactsLocationSasToken'))]", "dbType": "None", "connectionString": "", "setParameters": { "IIS Web Application Name": "[variables('replicationSiteName')]" } } } ] }, { "apiVersion": "2014-04-01", "name": "[concat(variables('webHostingPlanName'), '-autoscale')]", "type": "Microsoft.Insights/autoscalesettings", "location": "[resourceGroup().location]", "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]": "Resource", "displayName": "AutoScaleSettings-Web" }, "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]" ], "properties": { "profiles": [ { "name": "Default", "capacity": { "minimum": 1, "maximum": 2, "default": 1 }, "rules": [ { "metricTrigger": { "metricName": "CpuPercentage", "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]", "timeGrain": "PT1M", "statistic": "Average", "timeWindow": "PT10M", "timeAggregation": "Average", "operator": "GreaterThan", "threshold": 80.0 }, "scaleAction": { "direction": "Increase", "type": "ChangeCount", "value": 1, "cooldown": "PT10M" } }, { "metricTrigger": { "metricName": "CpuPercentage", "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]", "timeGrain": "PT1M", "statistic": "Average", "timeWindow": "PT1H", "timeAggregation": "Average", "operator": "LessThan", "threshold": 60.0 }, "scaleAction": { "direction": "Decrease", "type": "ChangeCount", "value": 1, "cooldown": "PT1H" } } ] } ], "enabled": false, "name": "[concat(variables('webHostingPlanName'), '-autoscale')]", "targetResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]" } }, { "apiVersion": "2014-04-01", "name": "[concat('ServerErrors ', variables('webSiteName'))]", "type": "Microsoft.Insights/alertrules", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('webSiteName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]": "Resource", "displayName": "ServerErrorsAlertRule-Web" }, "properties": { "name": "[concat('ServerErrors ', variables('webSiteName'))]", "description": "[concat(variables('webSiteName'), ' has some server errors, status code 5xx.')]", "isEnabled": false, "condition": { "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]", "metricName": "Http5xx" }, "operator": "GreaterThan", "threshold": 0.0, "windowSize": "PT5M" }, "action": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [ ] } } }, { "apiVersion": "2014-04-01", "name": "[concat('ForbiddenRequests ', variables('webSiteName'))]", "type": "Microsoft.Insights/alertrules", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('webSiteName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]": "Resource", "displayName": "ForbiddenRequestsAlertRule-Web" }, "properties": { "name": "[concat('ForbiddenRequests ', variables('webSiteName'))]", "description": "[concat(variables('webSiteName'), ' has some requests that are forbidden, status code 403.')]", "isEnabled": false, "condition": { "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]", "metricName": "Http403" }, "operator": "GreaterThan", "threshold": 0, "windowSize": "PT5M" }, "action": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [ ] } } }, { "apiVersion": "2014-04-01", "name": "[concat('CPUHigh ', variables('webHostingPlanName'))]", "type": "Microsoft.Insights/alertrules", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]": "Resource", "displayName": "CPUHighAlertRule-Web" }, "properties": { "name": "[concat('CPUHigh ', variables('webHostingPlanName'))]", "description": "[concat('The average CPU is high across all the instances of ', variables('webHostingPlanName'))]", "isEnabled": false, "condition": { "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]", "metricName": "CpuPercentage" }, "operator": "GreaterThan", "threshold": 90, "windowSize": "PT15M" }, "action": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [ ] } } }, { "apiVersion": "2014-04-01", "name": "[concat('LongHttpQueue ', variables('webHostingPlanName'))]", "type": "Microsoft.Insights/alertrules", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]": "Resource", "displayName": "LongHttpQueueAlertRule-Web" }, "properties": { "name": "[concat('LongHttpQueue ', variables('webHostingPlanName'))]", "description": "[concat('The HTTP queue for the instances of ', variables('webHostingPlanName'), ' has a large number of pending requests.')]", "isEnabled": false, "condition": { "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('webHostingPlanName'))]", "metricName": "HttpQueueLength" }, "operator": "GreaterThan", "threshold": 100.0, "windowSize": "PT5M" }, "action": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [ ] } } }, { "apiVersion": "2014-04-01", "name": "[variables('webSiteName')]", "type": "Microsoft.Insights/components", "location": "Central US", // Microsoft.Insights/components is only available here? "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('webSiteName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]": "Resource", "displayName": "AppInsightsComponent-Web" }, "properties": { "ApplicationId": "[variables('webSiteName')]" } }, { "name": "[variables('storageAccountName')]", "type": "Microsoft.Storage/storageAccounts", "location": "[resourceGroup().location]", "apiVersion": "2015-05-01-preview", "dependsOn": [ ], "tags": { "displayName": "StorageAccount" }, "properties": { "accountType": "[parameters('storageAccountType')]" } }, { "name": "[variables('storageAccountNameStaging')]", "type": "Microsoft.Storage/storageAccounts", "location": "[resourceGroup().location]", "apiVersion": "2015-05-01-preview", "dependsOn": [ ], "tags": { "displayName": "StorageAccount" }, "properties": { "accountType": "[parameters('storageAccountType')]" } } ] }
Tuesday, August 25, 2015 8:13 PM -
I think there is an known race condition issue when doing msdeploy after app settings or connection strings. Try doing msdeploy first, and then making both app settings and connection strings dependent on it.
David
- Marked as answer by Cory Crooks Wednesday, August 26, 2015 2:31 AM
Tuesday, August 25, 2015 8:46 PM -
I think it is the same issue as David suspected, in the other post I shared a template that does this (add MSDeploy as a dependency to other config/appsettings/connectionstring steps)
Thanks, Hosam
- Marked as answer by Cory Crooks Wednesday, August 26, 2015 2:31 AM
Tuesday, August 25, 2015 9:08 PM -
Yes, that makes sense. Thanks for your time!Wednesday, August 26, 2015 2:31 AM