In my pipeline file, after I deploy to an app service slot (which has network restrictions enabled), I want to execute an API on the app service, but keep getting 403 - Forbidden.
Here is my powershell task:
- stage: Deploy
jobs:
- deployment:
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
condition: eq(variables.deployToSlot, 'true')
inputs:
targetType: 'inline'
script: |
$repoUrl = "https://$(azureWebAppName)-staging.azurewebsites.net/api/warmup"
Invoke-RestMethod -Uri $repoUrl -Method "GET" -ContentType "application/json; charset=utf-8"
I added AzureDevOps service tag as inbound rule under network settings on the app service slot, thinking this would allow the API call from the pipeline to succeed:
Here is the result:
Error 403 - Forbidden
The web app you have attempted to reach has blocked your access.



scm.azurewebsites.net