Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.67k stars 5.1k forks source link

Incorrect FrontdoorCreate example uses location that's not 'global' #22554

Open thomas11 opened 1 year ago

thomas11 commented 1 year ago

This example of creating a Frontdoor specifies "location": "westus" in the request payload. However, in practice this results in an error "Frontdoor location must be global" from the service.

The example should be fixed to remove the location or set it to global, whichever is correct.

Note that I have not checked the example for other API versions - they might have the same issue.

navba-MSFT commented 1 year ago

@thomas11 Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT commented 1 year ago

@thomas11 Could you please confirm if you are referring to the Creating a new profile for Azure Front Door Standard or Azure Front Door Premium ? Awaiting your reply.

navba-MSFT commented 1 year ago

@thomas11 I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.

thomas11 commented 1 year ago

Hi @navba-MSFT, the example this issue is about comes from Microsoft and I linked it in the issue description. Whatever kind of Front Door this example creates, needs location "global".

navba-MSFT commented 1 year ago

@thomas11 Thanks for your reply. I tried to invoke this classic Front Door Rest API. It worked just fine.

I used location WestUS. Please find below the PUT Request Body details:

PUT https://management.azure.com/subscriptions/XXXXXX/resourceGroups/navbafddel/providers/Microsoft.Network/frontDoors/test?api-version=2022-05-01
Authorization: Bearer eyJ0eXXXXXXXXXXXX
Content-type: application/json

Request Body:

{
  "location": "westus",
  "tags": {
    "tag1": "value1",
    "tag2": "value2"
  },
  "properties": {
    "routingRules": [
      {
        "name": "routingRule1",
        "properties": {
          "frontendEndpoints": [
            {
              "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/frontendEndpoints/frontendEndpoint1"
            },
            {
              "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/frontendEndpoints/default"
            }
          ],
          "acceptedProtocols": [
            "Http"
          ],
          "patternsToMatch": [
            "/*"
          ],
          "routeConfiguration": {
            "@odata.type": "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration",
            "backendPool": {
              "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/backendPools/backendPool1"
            }
          },
          "enabledState": "Enabled"
        }
      }
    ],
    "healthProbeSettings": [
      {
        "name": "healthProbeSettings1",
        "properties": {
          "path": "/",
          "protocol": "Http",
          "intervalInSeconds": 120,
          "enabledState": "Enabled",
          "healthProbeMethod": "HEAD"
        }
      }
    ],
    "loadBalancingSettings": [
      {
        "name": "loadBalancingSettings1",
        "properties": {
          "sampleSize": 4,
          "successfulSamplesRequired": 2
        }
      }
    ],
    "backendPools": [
      {
        "name": "backendPool1",
        "properties": {
          "backends": [
            {
              "address": "w3.contoso.com",
              "httpPort": 80,
              "httpsPort": 443,
              "weight": 1,
              "priority": 2
            },
            {
              "address": "contoso.com.website-us-west-2.othercloud.net",
              "httpPort": 80,
              "httpsPort": 443,
              "weight": 2,
              "priority": 1
            },
            {
              "address": "contoso1.azurewebsites.net",
              "httpPort": 80,
              "httpsPort": 443,
              "weight": 1,
              "priority": 1
            }
          ],
          "loadBalancingSettings": {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/loadBalancingSettings/loadBalancingSettings1"
          },
          "healthProbeSettings": {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/healthProbeSettings/healthProbeSettings1"
          }
        }
      }
    ],
    "frontendEndpoints": [
      {
        "name": "frontendEndpoint1",
        "properties": {
          "hostName": "www.contoso.com",
          "sessionAffinityEnabledState": "Enabled",
          "sessionAffinityTtlSeconds": 60,
          "webApplicationFirewallPolicyLink": {
            "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policy1"
          }
        }
      },
      {
        "name": "default",
        "properties": {
          "hostName": "frontDoor1.azurefd.net"
        }
      }
    ],
    "backendPoolsSettings": {
      "enforceCertificateNameCheck": "Enabled",
      "sendRecvTimeoutSeconds": 60
    },
    "enabledState": "Enabled"
  }
}

So the example provided in your issue description for location westusis correct.

List of available regions for this resource type are : 'global,centralus,eastus,eastus2,northcentralus,southcentralus,westus,northeurope,westeurope,eastasia,southeastasia,japaneast,japanwest,brazilsouth,australiaeast,australiasoutheast'."

Hope this helps.

navba-MSFT commented 1 year ago

@thomas11 I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.

thomas11 commented 1 year ago

Hi @navba-MSFT, thank you for following up on this. I'm surprised the example worked for you. I copied it verbatim from your comment and replaced only the subscription and the resource group. Then I ran it like this:

$ az rest --method PUT -u https://management.azure.com/subscriptions/XXX/resourceGroups/tkappler-frontdoor/providers/Microsoft.Network/frontDoors/test\?api-version\=2020-05-01 --body @frontdoor.json

Bad Request({
  "error": {
    "code": "BadRequest",
    "message": "Frontdoor location must be global."
  }
})
ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cdnfdsuppgithub.

Issue Details
[This example of creating a Frontdoor](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorCreate.json#L8) specifies `"location": "westus"` in the request payload. However, in practice this results in an error _"Frontdoor location must be global"_ from the service. The example should be fixed to remove the location or set it to global, whichever is correct. Note that I have not checked the example for other API versions - they might have the same issue.
Author: thomas11
Assignees: -
Labels: `question`, `Service Attention`, `customer-reported`, `Network - Front Door`, `needs-team-attention`
Milestone: -
navba-MSFT commented 1 year ago

@thomas11 I tried again with your api-version and even that worked for me. For some reason I cannot reproduce this issue with the same above api. I am adding service team to look into this further.

@cdnfdsuppgithub Could you please look into this further ?