Skip to content

Instantly share code, notes, and snippets.

@The-Running-Dev
Created November 12, 2020 16:08
Show Gist options
  • Save The-Running-Dev/370286f80ba05ca47c309fc499d5f541 to your computer and use it in GitHub Desktop.
Save The-Running-Dev/370286f80ba05ca47c309fc499d5f541 to your computer and use it in GitHub Desktop.
Azure YAML task for generating a SAS token
- task: AzureCLI@2
name: generateToken
displayName: Generating SAS Token
inputs:
azureSubscription: ${{variables.subscription}}
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
$sasToken = az storage blob generate-sas `
--account-name ${{variables.templateStorageAccount}} `
--container-name ${{variables.templateStorageContainer}} `
--name ${{variables.nestedWebAppTemplate}} `
--permissions r `
--expiry $(Get-Date).AddMinutes(5).ToString("yyyy-MM-ddTHH:mmZ") `
--https-only `
--output tsv
Write-Output "##vso[task.setvariable variable=SASToken;isOutput=true]$sasToken"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment