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

az staticwebapp backends

使用静态 Web 应用链接或取消链接预先启动后端。 也称为“自带 API”。

命令

名称 说明 类型 状态
az staticwebapp backends link

将后端链接到静态 Web 应用。 也称为“自带 API”。

核心 GA
az staticwebapp backends show

显示链接到静态 Web 应用的后端的详细信息。

核心 GA
az staticwebapp backends unlink

从静态 Web 应用取消链接后端。

核心 GA
az staticwebapp backends validate

验证静态 Web 应用的后端。

核心 GA

将后端链接到静态 Web 应用。 也称为“自带 API”。

单个静态 Web 应用只能使用一个后端。 如果后端以前链接到另一个静态 Web 应用,必须先从后端中删除身份验证配置,然后再链接到其他静态 Web 应用。 静态 Web 应用 SKU 必须是“标准”。 支持的后端类型包括 Azure Functions、Azure API 管理、Azure App 服务、Azure 容器应用。 必须为 Azure Functions 和Azure App 服务类型的后端提供后端区域。 请参阅 https://video2.skills-academy.com/azure/static-web-apps/apis-overview 了解详细信息。

az staticwebapp backends link --backend-resource-id
                              --name
                              --resource-group
                              [--backend-region]
                              [--environment-name]

将后端链接到静态 Web 应用

az staticwebapp backends link -n MyStaticAppName -g MyResourceGroup --backend-resource-id "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/<resource-provider>/<resource-type>/<backend-name>" --backend-region MyBackendRegion

将后端链接到静态 Web 应用环境

az staticwebapp backends link -n MyStaticAppName -g MyResourceGroup --environment-name MyEnvironmentName --backend-resource-id "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/<resource-provider>/<resource-type>/<backend-name>" --backend-region MyBackendRegion
--backend-resource-id

要链接的后端的资源 ID。

--name -n

静态站点的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--backend-region

后端资源的区域。

--environment-name

静态站点环境的名称。

默认值: default
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az staticwebapp backends show

显示链接到静态 Web 应用的后端的详细信息。

az staticwebapp backends show --name
                              --resource-group
                              [--environment-name]

示例

显示静态 Web 应用后端。

az staticwebapp backends show -n MyStaticAppName -g MyResourceGroup

显示环境的静态 Web 应用后端。

az staticwebapp backends show -n MyStaticAppName -g MyResourceGroup --environment-name MyEnvironmentName

必需参数

--name -n

静态站点的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

可选参数

--environment-name

静态站点环境的名称。

默认值: default
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

从静态 Web 应用取消链接后端。

az staticwebapp backends unlink --name
                                --resource-group
                                [--environment-name]
                                [--remove-backend-auth]

取消链接静态应用后端。

az staticwebapp backends unlink -n MyStaticAppName -g MyResourceGroup

从静态 Web 应用环境取消链接后端,并从后端删除身份验证配置。

az staticwebapp backends unlink -n MyStaticAppName -g MyResourceGroup --environment-name MyEnvironmentName --remove-backend-auth
--name -n

静态站点的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--environment-name

静态站点环境的名称。

默认值: default
--remove-backend-auth

如果设置为 true,则删除链接过程中在后端配置的标识提供者。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az staticwebapp backends validate

验证静态 Web 应用的后端。

单个静态 Web 应用只能使用一个后端。 如果后端以前链接到另一个静态 Web 应用,必须先从后端中删除身份验证配置,然后再链接到其他静态 Web 应用。 静态 Web 应用 SKU 必须是“标准”。 支持的后端类型包括 Azure Functions、Azure API 管理、Azure App 服务、Azure 容器应用。 必须为 Azure Functions 和Azure App 服务类型的后端提供后端区域。 请参阅 https://video2.skills-academy.com/azure/static-web-apps/apis-overview 了解详细信息。

az staticwebapp backends validate --backend-resource-id
                                  --name
                                  --resource-group
                                  [--backend-region]
                                  [--environment-name]

示例

验证静态 Web 应用的后端

az staticwebapp backends validate -n MyStaticAppName -g MyResourceGroup --backend-resource-id "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/<resource-provider>/<resource-type>/<backend-name>" --backend-region MyBackendRegion

验证静态 Web 应用环境的后端

az staticwebapp backends validate -n MyStaticAppName -g MyResourceGroup --environment-name MyEnvironmentName --backend-resource-id "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/<resource-provider>/<resource-type>/<backend-name>" --backend-region MyBackendRegion

必需参数

--backend-resource-id

要链接的后端的资源 ID。

--name -n

静态站点的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

可选参数

--backend-region

后端资源的区域。

--environment-name

静态站点环境的名称。

默认值: default
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。