Search code examples
azure-devopscypressazure-devops-rest-apiazure-devops-server-2019

Azure DevOps getting 403(forbidden) in a Cypress Testing pipeline


I have an Azure DevOps pipeline that runs a series of tests(Cypress) against an App Service. This App Service has restricted access, so i get 403(forbidden) on every request, and i have been looking for the IP's to get white listed. After a lot of time looking, i read in a couple of places that they are changed quite often.

What am i missing?

Thank you,


Solution

  • If you are looking for IP ranges for Azure resources you will find them here. They are changed on a weekly basis, but this doesn't mean that all of them are changed. It simply means that file is updated once per week.

    In this file you must find resource and region of your choice:

        {
          "name": "AppService",
          "id": "AppService",
          "properties": {
            "changeNumber": 10,
            "region": "",
            "regionId": 0,
            "platform": "Azure",
            "systemService": "AzureAppService",
            "addressPrefixes": [
              "13.64.73.110/32",
              "13.65.30.245/32",
              "13.65.37.122/32",
              "13.65.39.165/32",
              "13.65.42.35/32",
              "13.65.42.183/32",
              "13.65.45.30/32",
              "13.65.85.146/32",
    
    

    So if you want to add some of these IPs to your restrictions you may parse json in powershell and then use this command in for loop

    Add-AzWebAppAccessRestrictionRule -ResourceGroupName "ResourceGroup" -WebAppName "AppName"
        -Name "Ip example rule" -Priority 100 -Action Allow -IpAddress 122.133.144.0/24