title: Getting "Access denied while saving the changes to cluster configuration file" when configuring appfabric caching service
body: <p>I'm stuck in this one... I'm trying to configure the first node for a cache cluster using appfabric. My architecture will be:</p>
  
  <ol>
  <li>4 Cluster Nodes</li>
  <li>All machines are inside a domain</li>
  <li>The configuration XML file will be in a NAS folder</li>
  </ol>
  
  <p>I've created a domain user and add read/write permissions to the NAS folder. Inside the machine, I've tried even to add the user to the administrators group, and it is the user configured to the caching service account but when the "Configure AppFabric" application is ending I get an error, but the odd thing is that the application starts to write the .xml configuration file, but it just deletes it before the error output!</p>
  
  <p>The error I get is:</p>
  
  <pre><code>System.Management.Automation.CmdletInvocationException: ErrorCode&lt;ERRCMS0002&gt;:SubStatus&lt;ES0001&gt;:Access denied while saving the changes to cluster configuration file. ---&gt; Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode&lt;ERRCMS0002&gt;:SubStatus&lt;ES0001&gt;:Access denied while saving the changes to cluster configuration file. ---&gt; System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
  at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl)
  at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, SafeHandle handle, AccessControlSections includeSections, Object exceptionContext)
  at System.Security.AccessControl.FileSystemSecurity.Persist(String fullPath)
  at System.Configuration.Internal.WriteFileContext.Complete(String filename, Boolean success)
  at System.Configuration.Internal.InternalConfigHost.StaticWriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
  at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
  at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
  at Microsoft.ApplicationServer.Caching.GlobalConfigReaderWriter.Save()
  --- End of inner exception stack trace ---
  at Microsoft.ApplicationServer.Caching.GlobalConfigReaderWriter.Save()
  at Microsoft.ApplicationServer.Caching.Configuration.Commands.NewCacheClusterCommand.BeginProcessing()
  --- End of inner exception stack trace ---
  at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
  at System.Management.Automation.Runspaces.Pipeline.Invoke()
  at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
  at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
  at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
  at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
  at System.Management.Automation.PowerShell.Invoke()
  at Microsoft.ApplicationServer.Configuration.DistributedCacheProxy.NewCacheCluster(String provider, String connectionString, String size)
  at Microsoft.ApplicationServer.Configuration.DistributedCacheNodePage.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
  </code></pre>
  
  <p>Can someone help me?</p>