Skip to content

Commit 6097fe4

Browse files
author
Rob Relyea
authored
Add examples using envvars for passwords in nuget.config (NuGet#2092)
Beef up examples and description of encrypted passwords only working on windows.
1 parent 4d03bcf commit 6097fe4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/reference/nuget-config-file.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ Stores usernames and passwords for sources, typically specified with the `-usern
131131
| Key | Value |
132132
| --- | --- |
133133
| username | The user name for the source in plain text. |
134-
| password | The encrypted password for the source. |
135-
| cleartextpassword | The unencrypted password for the source. |
134+
| password | The encrypted password for the source. Encrypted passwords are only supported on Windows, and only can be decrypted when used on the same machine and via the same user as the original encryption. |
135+
| cleartextpassword | The unencrypted password for the source. Note: environment variables can be used for improved security. |
136136

137137
**Example:**
138138

@@ -151,6 +151,21 @@ In the config file, the `<packageSourceCredentials>` element contains child node
151151
</packageSourceCredentials>
152152
```
153153

154+
When using unencrypted passwords stored in an environment variable:
155+
156+
```xml
157+
<packageSourceCredentials>
158+
<Contoso>
159+
<add key="Username" value="[email protected]" />
160+
<add key="ClearTextPassword" value="%ContosoPassword%" />
161+
</Contoso>
162+
<Test_x0020_Source>
163+
<add key="Username" value="user" />
164+
<add key="ClearTextPassword" value="%TestSourcePassword%" />
165+
</Test_x0020_Source>
166+
</packageSourceCredentials>
167+
```
168+
154169
When using unencrypted passwords:
155170

156171
```xml

0 commit comments

Comments
 (0)