title: Passing multiple parameters to function variables in Powershell
body: <p>I have an issue I can't figure out. It is a syntax problem that can't solve. Let's say I have this function:</p>
  
  <pre><code>function putStudentCourse ($userName, $courseId)
  {           
      $url = "http://myurl/learn/api/public/v1/courses/courseId:" + $courseId + "/users/userName:" + $userName
  
      $contentType = "application/json"       
      $basicAuth = post_token
      $headers = @{
                Authorization = $basicAuth
               }
      $body = @{
                grant_type = 'client_credentials'
               }
      $data = @{
              courseId = $courseId
              availability = @{
                  available = 'Yes'
                  }
              courseRoleId = 'Student'
          }
      $json = $data | ConvertTo-Json
  
      $putStudent = Invoke-RestMethod -Method Put -Uri $url -ContentType $contentType -Headers $headers -Body $json
  
      return $json
  }
  </code></pre>
  
  <p>And then my main method:</p>
  
  <pre><code>#MAIN
  
  $userName = "user02";
  $courseId = "CourseTest101"
  
  $output =  putStudentCourse($userName, $courseId)
  Write-Output $output
  </code></pre>
  
  <p>Right now it is just returning the first vale ($userName) but the output shows like this:</p>
  
  <pre><code>{
      "availability":  {
                           "available":  "Yes"
                       },
      "courseRoleId":  "Student",
      "courseId":  null
  }
  </code></pre>
  
  <p>Somehow $courseId is never filled and I am not sure why. What am I doing wrong?
  Any help will be appreciated it.</p>