xPSDesiredStateConfiguration icon indicating copy to clipboard operation
xPSDesiredStateConfiguration copied to clipboard

xPackage: Access to the path MSFT_xPackageResource is denied

Open viskin opened this issue 8 years ago • 0 comments

Occurs only when new server is deployed with Azure DSC extension, does not reproduce locally. Actually, this error also happens with plain Package resource.

The error is:

VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: "DSC Configuration 'Storage' completed with error(s). Following are the first few:
 PowerShell DSC resource MSFT_xPackageResource failed to execute Set-TargetResource functionality with error message: 
 The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: 
 Cannot remove item C:\ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xPackageResource\vcredist_x64_11.0.61030.0.exe:
  Access to the path 'C:\ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xPackageResource\vcredist_x64_11.0.61030.0.exe' is denied. 

Steps to reproduce:

  • In Azure, create DSC extension like this:
"extensions": [
                            {
                                "name": "Microsoft.Powershell.DSC",
                                "properties": {
                                    "publisher": "Microsoft.Powershell",
                                    "type": "DSC",
                                    "typeHandlerVersion": "2.9",
                                    "autoUpgradeMinorVersion": true,
                                    "forceUpdateTag": "1.0",
                                    "settings": {
                                        "wmfVersion": "latest",
                                        "configuration": {
                                            "url": "https://nnn.blob.core.windows.net/installations/Service.zip",
                                            "script": "Service.ps1",
                                            "function": "Service"
                                        },
                                        "privacy": {
                                            "dataCollection": "enable"
                                        },
                                        "advancedOptions": {
                                            "forcePullAndApply": false
                                        } 
                                    }
                                }
                            }
  • Add following xPackage resource to Service.ps1:
xPackage InstallVS2012Redist {
            Name      = "Microsoft Visual C++ 2012 Redistributable (x64) - 11.0.61030"
            Path      = "https://nnn.blob.core.windows.net/installations/vcredist_x64_11.0.61030.0.exe"
            ProductId = "37B8F9C7-03FB-3253-8781-2517C99D7C00"
            Arguments = "/passive /norestart"
            Ensure    = "Present"
        }
  • When new server added to Azure, attached error occurs.
  • Except the error, server state has all the resources applied.
  • Running Start-DscConfiguration for Service.ps1 on the server produces no error.
  • The file C:\ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xPackageResource\vcredist_x64_11.0.61030.0.exe that access to it is denied can be removed from File Explorer.

viskin avatar Feb 22 '18 08:02 viskin