title: Use parameter in PowerShell in Azure DevOps pipeline
body: <p>We have recently started using Azure DevOps Pipelines for our Dynamics 365 CRM implementation, but it is still new to me</p>
  <p>I recently came across <a href="https://crmchap.co.uk/migrating-microsoft-dataverse-access-team-templates-via-azure-devops/" rel="nofollow noreferrer">this</a> blog post by Joe Griffin on how you can use PowerShell in Azure DevOps pipelines to ensure, that Access Team Templates works when deploying a solution - and I would like to use that.</p>
  <p>However, I don't know where I add my parameters to script. Can I do that inline or do I need to add the script to my repo to do that? If so - how can I do that?</p>
  <pre><code>param(
      #objectTypeCode: Unique Code that identifies the table in the environment for the Access Team Template. Always potentially different.
      [Parameter(Mandatory=$true)]
      [int]$objectTypeCode,
      #atName: Name of the Access Team Template
      [Parameter(Mandatory=$true)]
      [String]$atName,
      #accessRights: Number which represents the access rights defined for the template. Refer to this article for details on how to construct: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/accessrights?view=dynamics-ce-odata-9
      [Parameter(Mandatory=$true)]
      [int]$accessRights,
      #d365URL: URL of the environment to connect to
      [Parameter(Mandatory=$true)]
      [String]$d365URL,
      #clientID: AAD Client ID for the Application User linked to this environment
      [Parameter(Mandatory=$true)]
      [String]$clientID,
      #clientSecret: AAD Client Secret for the Application User linked to this environment
      [Parameter(Mandatory=$true)]
      [String]$clientSecret
  )
  
  #Install dependencies
  Install-Module Microsoft.Xrm.Data.PowerShell -Scope CurrentUser -Force
  #Connect to the D365 environment
  $conn = Connect-CrmOnline -ServerUrl $d365URL -ClientSecret $clientSecret -OAuthClientId $clientID -OAuthRedirectUri &quot;http://localhost&quot;
  #We first attempt to retrieve the rows if they already exist, and update it accordingly; if this errors, then the row does not exist, so we need to create it instead
  Write-Host &quot;Processing Access Team Template for $atName...&quot;
  try
  {
      $atTemplate = Get-CrmRecord -conn $conn -EntityLogicalName teamtemplate -Id &quot;44396647-CEDF-EB11-BACB-000D3A5810F2&quot; -Fields teamtemplateid,teamtemplatename,objecttypecode,defaultaccessrightsmask,issystem
      $atTemplateId = $atTemplate.teamtemplateid
      Write-Host &quot;Got existing Access Team Template row with ID $atTemplateId!&quot;
      $atTemplate.teamtemplatename = $atName
      $atTemplate.objecttypecode = $objectTypeCode
      $atTemplate.defaultaccessrightsmask = $accessRights
      $atTemplate.issystem = 0
      Set-CrmRecord -conn $conn -CrmRecord $atTemplate
      Write-Host &quot;Successfully updated Access Team Template row with ID $atTemplateId!&quot;
  }
  catch [System.Management.Automation.RuntimeException]
  {
      Write-Host &quot;Access Template row with ID $atTemplateId does not exist, creating...&quot;
      $atTemplateId = New-CrmRecord -conn $conn -EntityLogicalName teamtemplate `
      -Fields @{&quot;teamtemplateid&quot;=[guid]&quot;{44396647-CEDF-EB11-BACB-000D3A5810F2}&quot;;&quot;teamtemplatename&quot;=$atName;&quot;objecttypecode&quot;=$objectTypeCode;&quot;defaultaccessrightsmask&quot;=$accessRights;&quot;issystem&quot;=0}   
      Write-Host &quot;Successfully created new Access Template row with ID $atTemplateId&quot;
  }
  Write-Host &quot;Script execution finished!&quot;
  </code></pre>