steps:
  - pwsh: |
      Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
      Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
    displayName: Set Vcpkg Variables

  - ${{if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
    - task: AzurePowerShell@5
      displayName: Set Vcpkg Write-mode Cache
      inputs:
        azureSubscription: 'Azure SDK Artifacts'
        ScriptType: FilePath
        ScriptPath: eng/scripts/Set-VcpkgWriteModeCache.ps1
        azurePowerShellVersion: LatestVersion
        pwsh: true
      # This step is idempotent and can be run multiple times in cases of
      # failure and partial execution.
      retryCountOnTaskFailure: 3
