Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting to Azure localStorage Error "Access to the path 'C:\Resources\directory\....' is denied
    primarykey
    data
    text
    <p>When I try to download a file from azure blob to azure localstorage,its showing me a message saying "Access to the path 'C:\Resources\directory....' is denied. <strong><em>As a workaround I added a statup task with power shell command to enable permission . But after this my web role is found to be taking more time to start and started finally. But I am still getting the access denied error message when its trying to write to it<code>.</code>Appreciate your suggestions to resolve this issue</em></strong></p> <p>I also tried changing my powershell script's Encoding to Unicode (UTF-8 without signature) - Codepage 65001. as mentioned <a href="http://social.msdn.microsoft.com/Forums/en-US/13e1fcf3-aa38-4b9a-82d2-ce8fba13fdd8/help-azure-local-storage-permission-problems" rel="nofollow">here</a> . but no luck .Please help </p> <p>Here is my StartUp.Cmd file</p> <pre><code> @echo off REM Attempt to set the execution policy by using PowerShell version 2.0 syntax. PowerShell -Version 2.0 -ExecutionPolicy Unrestricted .\fixfolderaccess.ps1 &gt;&gt; "%TEMP%\StartupLog.txt" 2&gt;&amp;1 IF %ERRORLEVEL% EQU -393216 ( REM PowerShell version 2.0 isn't available. Set the execution policy by using the PowerShell version 1.0 calling method. PowerShell -Command "Set-ExecutionPolicy Unrestricted" &gt;&gt; "%TEMP%\StartupLog.txt" 2&gt;&amp;1 PowerShell .\fixfolderaccess.ps1 &gt;&gt; "%TEMP%\StartupLog.txt" 2&gt;&amp;1 ) </code></pre> <p>Here is my powershell script--fixpermission.ps1 .</p> <pre><code>Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime while (!$?) { echo "Failed, retrying after five seconds..." sleep 5 Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime } echo "Added WA snapin." $localresource = Get-LocalResource "Resources" $folder = $localresource.RootPath $acl = Get-Acl $folder $rule1 = New-Object System.Security.AccessControl.FileSystemAccessRule( "Administrators", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow") $rule2 = New-Object System.Security.AccessControl.FileSystemAccessRule( "Everyone", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow") $acl.AddAccessRule($rule1) $acl.AddAccessRule($rule2) Set-Acl $folder $acl echo "Done changing ACLs." </code></pre> <p>my .cmd file and the fixpermission.ps1 files are both in web project directory and set property copy always=true. </p> <p><strong>If I manually run the startup.cmd on my local machine then i am getting the following error</strong> </p> <pre><code>.\fixfolderaccess.ps1 : The term '.\fixfolderaccess.ps1' is not recognized as t he name of a cmdlet, function, script file, or operable program. Check the spel ling of the name, or if a path was included, verify that the path is correct an d try again. At line:1 char:22 + .\fixfolderaccess.ps1 &lt;&lt;&lt;&lt; + CategoryInfo : ObjectNotFound: (.\fixfolderaccess.ps1:String) [ ], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException </code></pre> <p><strong>When I remote into my webrole and I can see error message pasted below.</strong></p> <pre><code>C a n n o t s t a r t W i n d o w s P o w e r S h e l l v e r s i o n 2 . 0 b e c a u s e i t i s n o t c o r r e c t l y i n s t a l l e d . Add-PSSnapin : Cannot load Windows PowerShell snap-in Microsoft.WindowsAzure.Se rviceRuntime because of the following error: The Windows PowerShell snap-in mod ule F:\plugins\RemoteAccess\Microsoft.WindowsAzure.ServiceRuntime.Commands.dll does not have required Windows PowerShell snap-in strong name Microsoft.Windows Azure.ServiceRuntime.Commands, Version=1.0.0.0, Culture=neutral, PublicKeyToken =31bf3856ad364e35. At F:\approot\bin\fixfolderaccess.ps1:1 char:13 + Add-PSSnapin &lt;&lt;&lt;&lt; Microsoft.WindowsAzure.ServiceRuntime Failed, retrying after five seconds... out-lineoutput : The OS handle's position is not what FileStream expected. Do n ot use a handle simultaneously in one FileStream and in Win32 code or another F ileStream. This may cause data loss. </code></pre> <p><strong>Now I actually logged into my azure webrole and manually executed the powershell script and I got the below error</strong></p> <p><em>Add-PSSnapin : Cannot load Windows PowerShell snap-in Microsoft.WindowsAzure.ServiceRuntime because of the following e ror: The Windows PowerShell snap-in module E:\plugins\RemoteAccess\Microsoft.WindowsAzure.ServiceRuntime.Commands.dll oes not have required Windows PowerShell snap-in strong name Microsoft.WindowsAzure.ServiceRuntime.Commands, Version=1 0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. At E:\sitesroot\0\bin\fixfolderaccess.ps1:8 char:17 + Add-PSSnapin &lt;&lt;&lt;&lt; Microsoft.WindowsAzure.ServiceRuntime</em></p> <p><strong>Question</strong> </p> <p>I recently upgraded to windows azure tools ver 2.1 and VisualStudio2012.But my project files targeting still pointing to Framework 4.0 .Do you think if I upgrade all my project files's target framework to .Net4.5 and upgrade every dll to the .net 4.5 and all these troubles may go away ?</p> <p><strong>Is there a straight forward way to grant required write access to azure local storage?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload