0

I encounter an error while deploying a package on an azure web app.

The app is a .NET web application, compiled for 4.0 framework.

Here is the command line I use for creating the package:

"msdeploy.exe" -verb:sync -source:dirpath="C:\Users\Pierre\Documents\Projets\MyProject\MyApp" -dest:package=C:\Users\Pierre\Documents\MyProject\AzureResourceGroup\MyApp.zip

Then, on deployment using azure resource groups templates I get the following error

<?xml version="1.0" encoding="utf-8"?>
<entries>
  <entry time="2016-01-06T09:55:20.4679645+00:00" type="Message">
    <message>Downloading metadata for package path 'artifacts/MyApp.zip' from blob 'https://ccfstoragee57wqq4suhjoy.blob.core.windows.net'</message>
  </entry>
  <entry time="2016-01-06T09:55:20.5148382+00:00" type="Message">
    <message>The blob has flag IsPremiumApp:. IsPremiumApp returns False</message>
  </entry>
  <entry time="2016-01-06T09:55:20.5617164Z" type="Message">
    <message>Downloading package path 'artifacts/MyApp.zip' from blob 'https://ccfstoragee57wqq4suhjoy.blob.core.windows.net'</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>No parameters were populated.</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>Calling SyncTo() on package.</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>Adding MSDeploy.dirPath (MSDeploy.dirPath).</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>Adding MSDeploy.dirPath (MSDeploy.dirPath).</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>Adding directory (C:\Users\Pierre\Documents\Projets\MyProject\MyApp).</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6280976Z" type="Message">
    <message>Adding directory (C:\Users\Pierre\Documents\Projets\MyProject\MyApp).</message>
  </entry>
  <entry time="2016-01-06T09:55:30.6593714Z" type="Error">
    <message>Package deployment failed</message>
  </entry>
  <entry time="2016-01-06T09:55:30.7267862Z" type="Error">
    <message>AppGallery Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedUnauthorizedAccessException: Unable to perform the operation ("Create Directory")  for the specified directory ("C:\Users\Pierre\Documents\Projets\MyProject\MyApp"). This can occur if the server administrator has not authorized this operation for the user credentials you are using.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER. ---&gt; Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070005. ---&gt; System.UnauthorizedAccessException: Access to the path 'C:\Users' is denied.
   at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
   at Microsoft.Web.Deployment.DirectoryEx.CreateDirectory(String path)
   at Microsoft.Web.Deployment.DirPathProviderBase.CreateDirectory(String fullPath, DeploymentObject source)
   at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Microsoft.Web.Deployment.FilePathProviderBase.HandleKnownRetryableExceptions(DeploymentBaseContext baseContext, Int32[] errorsToIgnore, Exception e, String path, String operation)
   at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf)
   at Microsoft.Web.Deployment.DeploymentObject.Add(DeploymentObject source, DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAdd(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleUpdate(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(String provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentWellKnownProvider provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId)
   at Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__b.MoveNext()'</message>
  </entry>
</entries>

It seems like the azure resource group is trying to recreate my local folders hierarchy on the azure web app.

On the other side, using a package created with Visual Studio --> Publish --> Package works fine. Manually creating the package from VS is not an option, and I can't understand why it fails when msdeploy.exe is used !!

2
  • What is the MsDeploy version you're using? Commented Jan 6, 2016 at 14:40
  • Version 7.1.618.0 located in C:\Program Files (x86)\IIS\Microsoft Web Deploy Commented Jan 6, 2016 at 17:26

2 Answers 2

3

Same issue here. Been struggling for several days now, and have pinpointed the problem to be in the serialized and encoded MSDeploy.MSDeployProviderOptions attribute value in archive.xml. The value contains the original folder structure from which the packaged files originated, and Web Deploy in Azure attempts to recreate the same structure on the target system. Running msdeploy with the "-replace" option when creating a package has absolutely no effect on those serialized options (could be a bug in msdeploy?).

UPDATE

Here's what finally worked for me:

msdeploy.exe
   -source:iisApp='C:\Users\alex\AppData\Local\Temp\PublishTemp\TheWorldVS47\wwwroot'
   -dest:package='C:\Code\TheWorldVS\PublishOutput\package.zip' 
   -verb:sync 
   -enableLink:contentLibExtension 
   -replace:match='C:\\Users\\alex\\AppData\\Local\\Temp\\PublishTemp\\TheWorldVS47\\',replace='website\' 
   -retryAttempts:2 
   -disablerule:BackupRule 
   -declareParam:name="IIS Web Application Name",kind="ProviderPath",scope="IisApp",match="^C:\\Users\\alex\\AppData\\Local\\Temp\\PublishTemp\\TheWorldVS47",defaultValue="website"

This last setting is what made it work by instructing MSDeploy in Azure that any occurrences of that long local path must be replaced with "website" by default. I suppose you could also further customize that value by providing an override for it in the ARM json template within the setParameters property of your MSDeploy extension block.

Sign up to request clarification or add additional context in comments.

Comments

1

Try using contentpath instead of dirpath, e.g.

"msdeploy.exe" -verb:sync -source:contentpath="C:\Users\Pierre\Documents\Projets\MyProject\MyApp" -dest:package=C:\Users\Pierre\Documents\MyProject\AzureResourceGroup\MyApp.zip

4 Comments

Same issue. When I look into the archive, in the archive.xml file, I still see directives with pull path contentPath path="C:\Users\Pierre\Documents\MyProject\MyApp" and MSDeploy.dirPath path="C:\Users\Pierre\Documents\MyProject\MyApp.
When you tried contentpath, did you first delete the old zip? If not, then it probably updated it, leaving some of the bad things from before. Make sure you run it clean.
I tried again today, deleting the previous archive before and recreating it from scratch with "-source:contentpath". But still the same ....
Strange, it worked for me when I tried. To isolate, does it also fail if you do a direct deployment to your site instead of doing it via template? Simplest way is to use WAWSDeploy tool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.