Access to the path is denied, Azure DevOps, Azure Deployment Center

I have been doing some testing with Azure Function deployments which requires me to break stuff.  That gets me into some real trouble sometimes when all I want is a deployment to work like normal.  Here are some other articles I wrote also while doing this.

A lot of times I end up deleting and starting over.  This is an interesting set of error messages which do not really describe the root of the issue.  The error message is true, but the reason wasn’t directly related to a permission on the ‘D:\home\site\deployments\settings.xml’ directory which is resolved sometimes using this.  The error message Access to the path ‘D:\home\site\deployments\settings.xml’ is denied.’ would rightly lead to that conclusion, but would likely lead you down the wrong path in search of resolution, at least initially.  The error should say something like, “hey, you have a network restriction of some kind that is preventing access to the Azure Storage Account.”   That is easier said than done, but it would be nice.  Especially this one that came up after I solved the network problem, but went away some minutes later, probably some kind of cache or scheduled process that needed to clean up some stuff. 

image

Figure 1, An error has occurred

Anyway, on my Azure Function I had this configured for my AzureWebJobStorage application setting.  Notice the storage name.

image

Figure 2, Azure Function AzureWebJobStorage application setting

Then, looking on the Networking blade for that storage account, you see that the Selected networks radio button is selected.  This prevents any resource from accessing the storage account, unless they are part or given specific permission to access.

image

Figure 3, Networking blade for that storage account, Selected networks

Since my Azure Function is dynamic / consumption, VNETs are not supported so there is no way for it to get access.  I had to remove the restriction from the Azure Storage Account.  I also had an Access restriction which was blocking a range of IP addresses.

image

Figure 4, Access restriction which was blocking a range of IP addresses

I disabled this first, but it did not resolve the issue, since the range wasn’t a match.  If your DevOps is a push from the repository, this could be a reason for deployments to fail.  It is worth checking out.  After all that I got the setup in Deployment Center to work.

image

Figure 5, setup in Deployment Center

Here is a bit more illustration of the exception I saw.



image

Failed to set up deployment: Repository ‘UpdateSiteSourceControl’ operation failed with System.Net.WebException: Access to the path ‘D:\home\site\deployments\settings.xml’ is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) at System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings) at System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) at XmlSettings.XmlUtility.CreateDocument(XName rootName, String path) at XmlSettings.XmlUtility.GetDocument(XName rootName, String path, Boolean createIfNotExists) at XmlSettings.Settings.GetDocument(Boolean createIfNotExists) at XmlSettings.Settings.SetValueInternal(String section, String key, String value) at XmlSettings.Settings.SetValue(String section, String key, String value) at Kudu.Core.Settings.DeploymentSettingsManager.SetValue(String key, String value) in C:\Kudu Files\Private\src\master\Kudu.Core\Settings\DeploymentSettingsManager.cs:line 93 at Kudu.Services.Settings.SettingsController.<>c__DisplayClass4_0.<Set>b__0() in