You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dsc/configurations/runAsUser.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,28 @@ title: Use Credentials with DSC Resources
7
7
8
8
> Applies To: Windows PowerShell 5.0, Windows PowerShell 5.1
9
9
10
-
You can run a DSC resource under a specified set of credentials by using the automatic **PsDscRunAsCredential** property in the configuration.
11
-
By default, DSC runs each resource as the system account.
12
-
There are times when running as a user is necessary, such as installing MSI packages in a specific user context, setting a user's registry keys, accessing a user's specific local directory,
13
-
or accessing a network share.
10
+
You can run a DSC resource under a specified set of credentials by using the automatic
11
+
**PsDscRunAsCredential** property in the configuration. By default, DSC runs each resource as the
12
+
system account. There are times when running as a user is necessary, such as installing MSI packages
13
+
in a specific user context, setting a user's registry keys, accessing a user's specific local
14
+
directory, or accessing a network share. The **SeInteractiveLogonRight** is required, by the target
15
+
machine, for any account you specify to **PSDSCRunAsCredential**. For more information, see
16
+
[Account Rights Constants](/windows/desktop/secauthz/account-rights-constants).
14
17
15
-
Every DSC resource has a **PsDscRunAsCredential** property that can be set to any user credentials (a [PSCredential](/dotnet/api/system.management.automation.pscredential) object).
16
-
The credential can be hard-coded as the value of the property in the configuration, or you can set the value to [Get-Credential](/powershell/module/Microsoft.PowerShell.Security/Get-Credential),
17
-
which will prompt the user for a credential when the configuration is compiled (for information about compiling configurations, see [Configurations](configurations.md).
18
+
Every DSC resource has a **PsDscRunAsCredential** property that can be set to any user credentials
19
+
(a [PSCredential](/dotnet/api/system.management.automation.pscredential) object). The credential can
20
+
be hard-coded as the value of the property in the configuration, or you can set the value to [Get-Credential](/powershell/module/Microsoft.PowerShell.Security/Get-Credential),
21
+
which will prompt the user for a credential when the configuration is compiled (for information
22
+
about compiling configurations, see [Configurations](configurations.md).
18
23
19
-
> [!NOTE]
20
-
> In PowerShell 5.0, using the **PsDscRunAsCredential** property in configurations calling composite resources was not supported.
21
-
> In PowerShell 5.1, the**PsDscRunAsCredential** property is supported in configurations calling composite resources.
22
-
> The **PsDscRunAsCredential** property is not available in PowerShell 4.0.
24
+
> [!NOTE] In PowerShell 5.0, using the **PsDscRunAsCredential** property in configurations calling
25
+
> composite resources was not supported. In PowerShell 5.1, the **PsDscRunAsCredential** property is
26
+
> supported in configurations calling composite resources. The**PsDscRunAsCredential** property is
27
+
> not available in PowerShell 4.0.
23
28
24
-
In the following example, `Get-Credential` is used to prompt the user for credentials.
25
-
The **Registry** resource is used to change the registry key that specifies the background color
26
-
for the Windows command prompt window.
29
+
In the following example, `Get-Credential` is used to prompt the user for credentials. The
30
+
**Registry** resource is used to change the registry key that specifies the background color for the
> This example assumes that you have a valid certificate at `C:\publicKeys\targetNode.cer`, and that the thumbprint of that certificate is the value shown.
65
-
> For information about encrypting credentials in DSC configuration MOF files, see [Securing the MOF file](../pull-server/secureMOF.md).
68
+
> [!NOTE] This example assumes that you have a valid certificate at `C:\publicKeys\targetNode.cer`,
69
+
> and that the thumbprint of that certificate is the value shown. For information about encrypting
70
+
> credentials in DSC configuration MOF files, see [Securing the MOF file](../pull-server/secureMOF.md).
0 commit comments