dsccommunity / WebAdministrationDsc

This module contains DSC resources for deploying and configuring web servers and related components.
MIT License
162 stars 149 forks source link

Parameter 'PhysicalPath' should point to existing path, on Azure File Share #595

Open cm5778 opened 3 years ago

cm5778 commented 3 years ago

I am trying to create a webApplication on IIS pointing to Azure File share using PowerShell DSC xWebApplication as below xWebApplication AppName { DependsOn = "[xWebSite]xWebSiteName" Name = "appname" PhysicalPath = "\azurefileshare\etc" WebAppPool = $AppPoolName Website = $WebSiteName } I am getting "Parameter 'PhysicalPath' should point to existing path." error where the mentioned path can be accessed manually and able to set to IIS application manually. All the user accounts involved in the process have full control access on file share Also observed in Process Monitor that PowerShell DSC kicks off "C:\windows\system32\wbem\wmiprvse.exe" running as NT AUTHORITY\SYSTEM and not sure how to change user when running th PowerShell DSC.

image

Can someone help in this regard please.

johlju commented 3 years ago

Consider using built-in parameter PSDscRunAsCredential to change what user the resource is run as.

cm5778 commented 3 years ago

@johlju apologies for not getting back sooner, I am having issue including PSDscRunAsCredential which I am trying to figure out, besides just to trim down the issue, I tried creating an application using Invoke-Command with credentials which giving Bad network error.

I will update on PSDscRunAsCredential

cm5778 commented 3 years ago

after adding below scripts $ConfigData = @{ AllNodes = @(
@{

The name of the node we are describing

                        NodeName = "$Computer"
                        PSDscAllowDomainUser = $true
                    };
                );    
    }

and below in configuration Registry CmdPath { Key = 'HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor' ValueName = 'DefaultColor' ValueData = '1F' ValueType = 'DWORD' Ensure = 'Present' Force = $true Hex = $true PsDscRunAsCredential = Get-Credential } I am getting this error: image

going through : https://docs.microsoft.com/en-us/powershell/scripting/dsc/pull-server/securemof?view=powershell-7.1

which suggesting to have encrypt mof using certs, except it seems a bit complicated, am I in right path

cm5778 commented 3 years ago

btw I am using PowerShell version 5.1