diff options
-rw-r--r-- | DOC_CHANGES.md | 31 | ||||
-rw-r--r-- | RELEASE_NOTES.md | 40 |
2 files changed, 71 insertions, 0 deletions
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md index b8eb61d12c..4c07dea872 100644 --- a/DOC_CHANGES.md +++ b/DOC_CHANGES.md @@ -6,6 +6,37 @@ Example Doc Change: Description of the required change. --> +### PSCredential Support for `dsc_script` + +`dsc_script` now supports the use of `ps_credential` to create a PSCredential +object similar to `dsc_resource`. The `ps_credential` helper function takes in +a string and when `to_s` is called on it, produces an object that can be embedded +in your `dsc_script`. For example, you can write: + +```ruby +dsc_script 'create-foo-user' do + code <<-EOH + User FooUser + { + UserName = 'FooUser' + Password = #{ps_credential('FooBarBaz1!')} + } + EOH + configuration_data <<-EOH + @{ + AllNodes = @( + @{ + NodeName = "localhost"; + CertificateID = 'A8DB81D8059F349F7EF19104399B898F701D4167' + } + ) + } + EOH +end +``` + +Note, you still need to configure the CertificateID in the LCM. + ### chef-client -j JSON Add to the [description of chef-client options](https://docs.chef.io/ctl_chef_client.html#options): diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c32309064a..cba5b9f415 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,46 @@ # Chef Client Release Notes 12.5.0: * OSX 10.11 support (support for SIP and service changes) +## PSCredential support for the `dsc_script` resource + +The `dsc_script` resource now supports the use of the `ps_credential` +helper method. This method generates a Ruby object which can be described +as a Powershell PSCredential object. For example, if you wanted to created +a user using DSC, previously you would have had to do something like: + +```ruby +dsc_script 'create-foo-user' do + code <<-EOH + $username = "placeholder" + $password = "#{FooBarBaz1!}" | ConvertTo-SecureString -asPlainText -Force + $cred = New-Object System.Management.Automation.PSCredential($username, $password) + User FooUser00 + { + Ensure = "Present" + UserName = 'FooUser00' + Password = $cred + } + EOH + configuration_data_script "path/to/config/data.psd1" +end +``` + +This can now be replaced with + +```ruby +dsc_script 'create-foo-user' do + code <<-EOH + User FooUser00 + { + Ensure = "Present" + UserName = 'FooUser00' + Password = #{ps_credential("FooBarBaz1!")} + } + EOH + configuration_data_script "path/to/config/data.psd1" +end +``` + ## New `knife rehash` for faster command loading The new `knife rehash` command speeds up day-to-day knife usage by |