How do I write an inline multiline powershell script in an Azure Pipelines PowerShell task?

You can use the pipe character (the literal Block Scalar Indicator) to define a multi-line block of text with newline characters such as your inline script; for example like this:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Write your PowerShell commands here.
      Write-Host "Hello world"
      Write-Host "Hullo clouds"
      Write-Host "Hullo sky"

It is possible to just use the powershell task like this:

# Job definition etc
steps:
  - powershell: |
      Write-Host A
      Write-Host B
      Write-Host C
  - task: AzureRmWebAppDeployment@4
      # The rest of this task is omitted.

If you use powershell instead of task: PowerShell@2 the target type defaults to inline and you don't need to set it again.