你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Routes - Create

在指定的订阅、资源组、配置文件和 AzureFrontDoor 终结点下创建具有指定路由名称的新路由。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}?api-version=2023-05-01

URI 参数

名称 必需 类型 说明
endpointName
path True

string

配置文件下全局唯一的终结点的名称。

profileName
path True

string

Azure Front Door Standard 或 Azure Front Door Premium 配置文件的名称,该配置文件在资源组中是唯一的。

resourceGroupName
path True

string

Azure 订阅中资源组的名称。

Regex pattern: ^[-\w\._\(\)]+$

routeName
path True

string

路由规则的名称。

subscriptionId
path True

string

Azure 订阅 ID。

api-version
query True

string

要与客户端请求一起使用的 API 的版本。 当前版本为 2023-05-01。

请求正文

名称 必需 类型 说明
properties.originGroup True

ResourceReference

对源组的引用。

properties.cacheConfiguration

AfdRouteCacheConfiguration

此路由的缓存配置。 若要禁用缓存,请不要提供 cacheConfiguration 对象。

properties.customDomains

ActivatedResourceReference[]

此终结点引用的域。

properties.enabledState

EnabledState

是否要启用此规则。 允许的值为“Enabled”或“Disabled”

properties.forwardingProtocol

ForwardingProtocol

将流量转发到后端时此规则将使用的协议。

properties.httpsRedirect

httpsRedirect

是否自动将 HTTP 流量重定向到 HTTPS 流量。 请注意,这是设置此规则的简单方法,这将是执行的第一个规则。

properties.linkToDefaultDomain

LinkToDefaultDomain

此路由是否将链接到默认终结点域。

properties.originPath

string

源上的目录路径,AzureFrontDoor 可以使用该路径从中检索内容,例如 contoso.cloudapp.net/originpath。

properties.patternsToMatch

string[]

规则的路由模式。

properties.ruleSets

ResourceReference[]

此终结点引用的规则集。

properties.supportedProtocols

AFDEndpointProtocols[]

此路由支持的协议列表。

响应

名称 类型 说明
200 OK

Route

确定

201 Created

Route

Created. 请求已满足,并已创建新的终结点。

202 Accepted

Route

已接受。 已接受请求进行处理,操作将以异步方式完成。

Headers

location: string

Other Status Codes

AfdErrorResponse

描述操作失败原因的 Azure Front Door 错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

Routes_Create

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1?api-version=2023-05-01

{
  "properties": {
    "customDomains": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1"
      }
    ],
    "originGroup": {
      "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1"
    },
    "originPath": null,
    "ruleSets": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1"
      }
    ],
    "supportedProtocols": [
      "Https",
      "Http"
    ],
    "patternsToMatch": [
      "/*"
    ],
    "cacheConfiguration": {
      "compressionSettings": {
        "contentTypesToCompress": [
          "text/html",
          "application/octet-stream"
        ],
        "isCompressionEnabled": true
      },
      "queryStringCachingBehavior": "IgnoreSpecifiedQueryStrings",
      "queryParameters": "querystring=test"
    },
    "forwardingProtocol": "MatchRequest",
    "linkToDefaultDomain": "Enabled",
    "httpsRedirect": "Enabled",
    "enabledState": "Enabled"
  }
}

Sample Response

{
  "name": "route1",
  "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/afdendpoints/endpoint1/routes/route1",
  "type": "Microsoft.Cdn/profiles/afdendpoints/routes",
  "properties": {
    "customDomains": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1"
      }
    ],
    "originGroup": {
      "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1"
    },
    "originPath": null,
    "ruleSets": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1"
      }
    ],
    "supportedProtocols": [
      "Https",
      "Http"
    ],
    "patternsToMatch": [
      "/*"
    ],
    "cacheConfiguration": {
      "compressionSettings": {
        "contentTypesToCompress": [
          "text/html",
          "application/octet-stream"
        ],
        "isCompressionEnabled": true
      },
      "queryStringCachingBehavior": "IgnoreSpecifiedQueryStrings",
      "queryParameters": "querystring=test"
    },
    "forwardingProtocol": "MatchRequest",
    "linkToDefaultDomain": "Enabled",
    "httpsRedirect": "Enabled",
    "enabledState": "Enabled",
    "provisioningState": "Succeeded",
    "deploymentStatus": "NotStarted"
  }
}
{
  "name": "route1",
  "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/afdendpoints/endpoint1/routes/route1",
  "type": "Microsoft.Cdn/profiles/afdendpoints/routes",
  "properties": {
    "customDomains": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1"
      }
    ],
    "originGroup": {
      "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1"
    },
    "originPath": null,
    "ruleSets": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1"
      }
    ],
    "supportedProtocols": [
      "Https",
      "Http"
    ],
    "patternsToMatch": [
      "/*"
    ],
    "cacheConfiguration": {
      "compressionSettings": {
        "contentTypesToCompress": [
          "text/html",
          "application/octet-stream"
        ],
        "isCompressionEnabled": true
      },
      "queryStringCachingBehavior": "IgnoreSpecifiedQueryStrings",
      "queryParameters": "querystring=test"
    },
    "forwardingProtocol": "MatchRequest",
    "linkToDefaultDomain": "Enabled",
    "httpsRedirect": "Enabled",
    "enabledState": "Enabled",
    "provisioningState": "Succeeded",
    "deploymentStatus": "NotStarted"
  }
}
azure-asyncoperation: https://management.azure.com/subscriptions/subid/resourcegroups/resourceGroupName/providers/Microsoft.Cdn/operationresults/operationId?api-version=2023-05-01
{
  "name": "route1",
  "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/afdendpoints/endpoint1/routes/route1",
  "type": "Microsoft.Cdn/profiles/afdendpoints/routes",
  "properties": {
    "customDomains": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1"
      }
    ],
    "originGroup": {
      "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1"
    },
    "originPath": null,
    "ruleSets": [
      {
        "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1"
      }
    ],
    "supportedProtocols": [
      "Https",
      "Http"
    ],
    "patternsToMatch": [
      "/*"
    ],
    "cacheConfiguration": {
      "compressionSettings": {
        "contentTypesToCompress": [
          "text/html",
          "application/octet-stream"
        ],
        "isCompressionEnabled": true
      },
      "queryStringCachingBehavior": "IgnoreSpecifiedQueryStrings",
      "queryParameters": "querystring=test"
    },
    "forwardingProtocol": "MatchRequest",
    "linkToDefaultDomain": "Enabled",
    "httpsRedirect": "Enabled",
    "enabledState": "Enabled",
    "provisioningState": "Creating",
    "deploymentStatus": "NotStarted"
  }
}

定义

名称 说明
ActivatedResourceReference

对另一个资源的引用及其状态。

AFDEndpointProtocols

客户的终结点支持的协议。

AfdErrorResponse

错误响应

AfdProvisioningState

预配状态

afdQueryStringCachingBehavior

定义 Frontdoor 如何缓存包含查询字符串的请求。 可以在缓存时忽略任何查询字符串、忽略特定查询字符串、使用唯一 URL 缓存每个请求或缓存特定的查询字符串。

AfdRouteCacheConfiguration

缓存类型路由的缓存设置。 若要禁用缓存,请不要提供 cacheConfiguration 对象。

CompressionSettings

用于压缩的设置。

DeploymentStatus
EnabledState

是否要启用此规则。 允许的值为“Enabled”或“Disabled”

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ForwardingProtocol

将流量转发到后端时此规则将使用的协议。

httpsRedirect

是否自动将 HTTP 流量重定向到 HTTPS 流量。 请注意,这是设置此规则的简单方法,这将是执行的第一个规则。

IdentityType

创建/修改资源的标识类型

LinkToDefaultDomain

此路由是否将链接到默认终结点域。

ResourceReference

对另一个资源的引用。

Route

友好路由名称映射到任何路由或机密相关信息。

SystemData

只读系统数据

ActivatedResourceReference

对另一个资源的引用及其状态。

名称 类型 说明
id

string

资源 ID。

isActive

boolean

资源是活动还是非活动

AFDEndpointProtocols

客户的终结点支持的协议。

名称 类型 说明
Http

string

Https

string

AfdErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

AfdProvisioningState

预配状态

名称 类型 说明
Creating

string

Deleting

string

Failed

string

Succeeded

string

Updating

string

afdQueryStringCachingBehavior

定义 Frontdoor 如何缓存包含查询字符串的请求。 可以在缓存时忽略任何查询字符串、忽略特定查询字符串、使用唯一 URL 缓存每个请求或缓存特定的查询字符串。

名称 类型 说明
IgnoreQueryString

string

IgnoreSpecifiedQueryStrings

string

IncludeSpecifiedQueryStrings

string

UseQueryString

string

AfdRouteCacheConfiguration

缓存类型路由的缓存设置。 若要禁用缓存,请不要提供 cacheConfiguration 对象。

名称 类型 说明
compressionSettings

CompressionSettings

压缩设置。

queryParameters

string

要包含或排除 (逗号分隔) 的查询参数。

queryStringCachingBehavior

afdQueryStringCachingBehavior

定义 Frontdoor 如何缓存包含查询字符串的请求。 可以在缓存时忽略任何查询字符串、忽略特定查询字符串、使用唯一 URL 缓存每个请求或缓存特定的查询字符串。

CompressionSettings

用于压缩的设置。

名称 类型 说明
contentTypesToCompress

string[]

应用压缩的内容类型列表。 该值应为有效的 MIME 类型。

isCompressionEnabled

boolean

指示是否在 AzureFrontDoor 上启用内容压缩。 默认值为 false。 如果启用了压缩,当用户请求压缩版本时,内容将作为压缩内容提供。 当请求的内容小于 1 字节或大于 1 MB 时,不会在 AzureFrontDoor 上压缩内容。

DeploymentStatus

名称 类型 说明
Failed

string

InProgress

string

NotStarted

string

Succeeded

string

EnabledState

是否要启用此规则。 允许的值为“Enabled”或“Disabled”

名称 类型 说明
Disabled

string

Enabled

string

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ForwardingProtocol

将流量转发到后端时此规则将使用的协议。

名称 类型 说明
HttpOnly

string

HttpsOnly

string

MatchRequest

string

httpsRedirect

是否自动将 HTTP 流量重定向到 HTTPS 流量。 请注意,这是设置此规则的简单方法,这将是执行的第一个规则。

名称 类型 说明
Disabled

string

Enabled

string

IdentityType

创建/修改资源的标识类型

名称 类型 说明
application

string

key

string

managedIdentity

string

user

string

LinkToDefaultDomain

此路由是否将链接到默认终结点域。

名称 类型 说明
Disabled

string

Enabled

string

ResourceReference

对另一个资源的引用。

名称 类型 说明
id

string

资源 ID。

Route

友好路由名称映射到任何路由或机密相关信息。

名称 类型 默认值 说明
id

string

资源 ID。

name

string

资源名称。

properties.cacheConfiguration

AfdRouteCacheConfiguration

此路由的缓存配置。 若要禁用缓存,请不要提供 cacheConfiguration 对象。

properties.customDomains

ActivatedResourceReference[]

此终结点引用的域。

properties.deploymentStatus

DeploymentStatus

properties.enabledState

EnabledState

是否要启用此规则。 允许的值为“Enabled”或“Disabled”

properties.endpointName

string

保存路由的终结点的名称。

properties.forwardingProtocol

ForwardingProtocol

MatchRequest

将流量转发到后端时此规则将使用的协议。

properties.httpsRedirect

httpsRedirect

Disabled

是否自动将 HTTP 流量重定向到 HTTPS 流量。 请注意,这是设置此规则的简单方法,这将是执行的第一个规则。

properties.linkToDefaultDomain

LinkToDefaultDomain

Disabled

此路由是否将链接到默认终结点域。

properties.originGroup

ResourceReference

对源组的引用。

properties.originPath

string

源上的目录路径,AzureFrontDoor 可以使用该路径从中检索内容,例如 contoso.cloudapp.net/originpath。

properties.patternsToMatch

string[]

规则的路由模式。

properties.provisioningState

AfdProvisioningState

预配状态

properties.ruleSets

ResourceReference[]

此终结点引用的规则集。

properties.supportedProtocols

AFDEndpointProtocols[]

[ "Http", "Https" ]

此路由支持的协议列表。

systemData

SystemData

只读系统数据

type

string

资源类型。

SystemData

只读系统数据

名称 类型 说明
createdAt

string

资源创建时间戳 (UTC)

createdBy

string

创建资源的标识的标识符

createdByType

IdentityType

创建资源的标识类型

lastModifiedAt

string

资源上次修改的时间戳 (UTC)

lastModifiedBy

string

上次修改资源的标识的标识符

lastModifiedByType

IdentityType

上次修改资源的标识类型