Inspec with a different username and password (windows)

Hello Chef Community,

I had a question that you might be able to help me. I have been running chef for some time and I understand why when the client runs it does it with the root\system account. I came across a scenario that the verify (inspec) stage needs to run as a different user.

we are using dsc_resource to install an Exchange Server and Configure it. This is done with a specific user because of some dependencies with AD (membership - domain admin\schema admin etc). This is possible because we can run the dsc_resource with the credential helper. more information here:

The problem is that I need to run some powershell inpec test and with the local account it won't be able to do so because it doesn't have the correct permissions to run it (you need Organizational Management in Exchange to do so)

Is there a way that we can run inspec test when we do kitchen verify as a different user that has been pre-created and has the correct permissions instead of the local account. this will help us run the following scripts and get the correct test for the Exchange Application as we build our cookbook.


exchange_product_key = <<-EOH
  Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
  Get-ExchangeServer $env:COMPUTERNAME | select -ExpandProperty IsExchangeTrialEdition

describe powershell(exchange_product_key) do
  its('stdout') { should cmp(/^False/) }

Let me know if you need more information and thank you in advance for the help.

Some references we have been looking at:

It would be best to change this in kitchen, to allow you to specify an user and password/key for just the verify phase. Then update to use the verifier user details when provided.

I don't think this is possible in the current kitchen.

Thank you for the response.