title: Passing PSCredential Class as parameter in SqlServerDsc module
body: <p>I'm new to posting and new to powershell DSC and powershell in general. I'm testing the SqlServiceAccount resource in the SqlServerDsc module and can't figure out how to use the PSCredential Class. My goal is to have the credentials in the variable, but can't figure out how to do this properly. I looked at the example and read the psm1 for the resource on it's github but still lost. 
  Here's the code I'm using to test it, the password as well as other info is in another script being called at the bottom of this script. The window prompting me to input credentials is popping up but I want my credentials placed in the variable to populate this.</p>
  
  <pre><code>Configuration SQLInstall
  
  {param (
      [Parameter(Mandatory=$true)]
      [ValidateNotNullOrEmpty()]
      [String]
      $PackagePath,
  
      [Parameter(Mandatory = $true)]
      [System.Management.Automation.PSCredential]
      $ServiceAccountCredential
  
  )
  Import-DscResource –ModuleName PSDesiredStateConfiguration
  Import-DSCResource -ModuleName ComputerManagementDsc
  Import-DSCResource -ModuleName SqlServerDsc
  
  Node $AllNodes.where{ $_.Role.Contains("SQLENGINE") }.NodeName
  {
  
      Log ParamLog
      {
          Message = "Running SQLInstall. PackagePath = $PackagePath"
      }
  
  # Password info here
  $password = $using:Node.Service4SQLPassword | ConvertTo-SecureString -asPlainText -Force 
  $username = $using:Node.Service4SQLAccount 
  $Credential = New-Object System.Management.Automation.PSCredential($username,$password)
  
      SqlServiceAccount SetServiceAccount_DatabaseEngine
      {
          ServerName     = $Node.NodeName
          InstanceName   = 'MSSQLSERVER'
          ServiceType    = 'DatabaseEngine'
          ServiceAccount = $ServiceAccountCredential
          RestartService = $true
          Force          = $true
          DependsOn      = "[Script]InstallSQLServer"
      }
  
      SqlServiceAccount SetServiceAccount_SQLServerAgent
      {
          ServerName     = $Node.NodeName
          InstanceName   = 'MSSQLSERVER'
          ServiceType    = 'SQLServerAgent'
          ServiceAccount = $ServiceAccountCredential
          RestartService = $true
          Force          = $true
          DependsOn      = "[Script]InstallSQLServer"
      }
  
      SqlServiceAccount SetServiceAccount_IntegrationServices
      {
          ServerName     = $Node.NodeName
          InstanceName   = 'MSSQLSERVER'
          ServiceType    = 'IntegrationServices'
          ServiceAccount = $ServiceAccountCredential
          RestartService = $true
          Force          = $true
          DependsOn      = "[Script]InstallSQLServer"
      }               
  }}
  
  SQLInstall -ConfigurationData C:\PowerShell_UserScripts\MyServerData.psd1 `
  </code></pre>