Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM template - website deployment failure

I’m attempting to use Azure Resource manager (ARM) template files to deploy as ASP.net website and am hitting a roadblock. This is a nascent feature of Azure so there isn’t much know-how out on the web about it, hoping someone here can help instead.

I can successfully create a new site (i.e. a Microsoft.Web/sites resource) in a new resource group i.e. it works when I define a website in the ARM template like so:

{
  "apiVersion": "2014-06-01",
  "name": "[parameters('siteName')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('siteLocation')]",
  "tags": {
    "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
    "displayName": "Website"

  },
  "dependsOn": [
    "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
  ],
  "properties": {
    "name": "[parameters('siteName')]",
    "serverFarm": "[parameters('hostingPlanName')]"
  }
}

My problem comes when I try to deploy an ASP.net website into it. Here’s what I have added to my ARM template:

{
  "apiVersion": "2014-06-01",
  "name": "[parameters('siteName')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('siteLocation')]",
  "tags": {
    "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
    "displayName": "Website"

  },
  "dependsOn": [
    "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
  ],
  "properties": {
    "name": "[parameters('siteName')]",
    "serverFarm": "[parameters('hostingPlanName')]"
  },
  "resources": [
    {
      "apiVersion": "2014-06-01",
      "type": "extensions",
      "name": "MSDeploy",
      "dependsOn": [ "[concat('Microsoft.Web/sites/', parameters('siteName'))]" ],
      "properties": {
        "connectionString": "",
        "dbType": "",
        "packageUri": "file:///D:/svn/dh.PSP.Conductor/dh.PSP.Conductor.AzureResourceGroup/obj/Release/ProjectReferences/dh.PSP.Conductor.Api/package.zip"
      }
    }
  ]
}

I’m deploying from PowerShell and it fails with:

New-AzureResourceGroup : 16:00:35 - Resource Microsoft.Web/sites/extensions 'ARMTest20150604/MSDeploy' failed with message 'The resource operation completed with terminal provisioning state 'Failed'.'

If I look in the portal I see a slightly more useful error:

statusCode:Conflict statusMessage:{"status":"Failed","error":{"code":"ResourceDeploymentFailure","message":"The resource operation completed with terminal provisioning state 'Failed'."}}

enter image description here I’m none the wiser as to why this is failing however. Can anyone suggest how I might investigate further?

like image 609
jamiet Avatar asked Jun 04 '15 15:06

jamiet


1 Answers

Fault is mine (as you might expect). Its not possible to reference a local file for the packageUri property, the file needs to be uploaded to blob storage first.

Something else useful I've found out, a deployment log is available by browsing to https://websitename.scm.azurewebsites.net/DebugConsole, "cd logfiles\siteextensions\msdeploy", open appManagerLog.xml. Much more useful information in there. In my case:

<entry time="2015-06-04T15:28:12.0718158+00:00" type="Error">
        <message>AppGallery Deploy Failed: 'System.UriFormatException: Invalid URI: The URI is empty.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Uri..ctor(String uriString)
   at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.IsPremiumApp()
   at Microsoft.Web.Deployment.WebApi.DeploymentController.CheckCanDeployIfAppIsPremium(AppGalleryPackageInfo packageInfo, Boolean&amp;amp; isPremium)'</message>
    </entry>
    <entry time="2015-06-04T15:28:12.1186872Z" type="Message">
        <message>Downloading package path 'D:\svn\dh.PSP.Conductor\dh.PSP.Conductor.AzureResourceGroup\obj\Release\ProjectReferences\dh.PSP.Conductor.Api\package.zip' from blob ''</message>
    </entry>
    <entry time="2015-06-04T15:28:12.1186872Z" type="Error">
        <message>Failed to download package.</message>
    </entry>
like image 159
jamiet Avatar answered Nov 14 '22 00:11

jamiet