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

az containerapp ingress cors

用于管理容器应用的 CORS 策略的命令。

命令

名称 说明 类型 状态
az containerapp ingress cors disable

为容器应用禁用 CORS 策略。

核心 GA
az containerapp ingress cors enable

为容器应用启用 CORS 策略。

核心 GA
az containerapp ingress cors show

显示容器应用的 CORS 策略。

核心 GA
az containerapp ingress cors update

更新容器应用的 CORS 策略。

核心 GA

az containerapp ingress cors disable

为容器应用禁用 CORS 策略。

az containerapp ingress cors disable [--ids]
                                     [--name]
                                     [--resource-group]
                                     [--subscription]

示例

为容器应用禁用 CORS 策略。

az containerapp ingress cors disable -n my-containerapp -g MyResourceGroup

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

Containerapp 的名称。 名称必须包含小写字母数字字符或“-”,以字母开头,以字母数字字符结尾,不能有“--”,并且必须小于 32 个字符。

--resource-group -g

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

--subscription

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

全局参数
--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 containerapp ingress cors enable

为容器应用启用 CORS 策略。

az containerapp ingress cors enable --allowed-origins
                                    [--allow-credentials {false, true}]
                                    [--allowed-headers]
                                    [--allowed-methods]
                                    [--expose-headers]
                                    [--ids]
                                    [--max-age]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]

示例

为容器应用设置允许的源和允许的方法。

az containerapp ingress cors enable -n my-containerapp -g MyResourceGroup --allowed-origins http://www.contoso.com https://www.contoso.com --allowed-methods GET POST

为容器应用设置允许的源、允许的方法和允许的标头。

az containerapp ingress cors enable -n my-containerapp -g MyResourceGroup --allowed-origins * --allowed-methods * --allowed-headers header1 header2

必需参数

--allowed-origins -r

容器应用的允许源列表。 值是空格分隔的。 用于清除现有值的空字符串。

可选参数

--allow-credentials

容器应用是否允许凭据。

接受的值: false, true
--allowed-headers -a

容器应用的允许标头列表。 值是空格分隔的。 用于清除现有值的空字符串。

--allowed-methods -m

容器应用的允许方法列表。 值是空格分隔的。 用于清除现有值的空字符串。

--expose-headers -e

容器应用的公开标头列表。 值是空格分隔的。 用于清除现有值的空字符串。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--max-age

允许的源的最大期限(以秒为单位)。 只允许有后置整数或空字符串。 空字符串将max_age重置为 null。

--name -n

Containerapp 的名称。 名称必须包含小写字母数字字符或“-”,以字母开头,以字母数字字符结尾,不能有“--”,并且必须小于 32 个字符。

--resource-group -g

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

--subscription

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

全局参数
--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 containerapp ingress cors show

显示容器应用的 CORS 策略。

az containerapp ingress cors show [--ids]
                                  [--name]
                                  [--resource-group]
                                  [--subscription]

示例

显示容器应用的 CORS 策略。

az containerapp ingress cors show -n my-containerapp -g MyResourceGroup

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

Containerapp 的名称。 名称必须包含小写字母数字字符或“-”,以字母开头,以字母数字字符结尾,不能有“--”,并且必须小于 32 个字符。

--resource-group -g

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

--subscription

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

全局参数
--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 containerapp ingress cors update

更新容器应用的 CORS 策略。

az containerapp ingress cors update [--allow-credentials {false, true}]
                                    [--allowed-headers]
                                    [--allowed-methods]
                                    [--allowed-origins]
                                    [--expose-headers]
                                    [--ids]
                                    [--max-age]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]

示例

更新容器应用的允许源和允许的方法,同时保留其他 cors 设置。

az containerapp ingress cors update -n my-containerapp -g MyResourceGroup --allowed-origins http://www.contoso.com https://www.contoso.com --allowed-methods GET POST

可选参数

--allow-credentials

容器应用是否允许凭据。

接受的值: false, true
--allowed-headers -a

容器应用的允许标头列表。 值是空格分隔的。 用于清除现有值的空字符串。

--allowed-methods -m

容器应用的允许方法列表。 值是空格分隔的。 用于清除现有值的空字符串。

--allowed-origins -r

容器应用的允许源列表。 值是空格分隔的。 用于清除现有值的空字符串。

--expose-headers -e

容器应用的公开标头列表。 值是空格分隔的。 用于清除现有值的空字符串。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--max-age

允许的源的最大期限(以秒为单位)。 只允许有后置整数或空字符串。 空字符串将max_age重置为 null。

--name -n

Containerapp 的名称。 名称必须包含小写字母数字字符或“-”,以字母开头,以字母数字字符结尾,不能有“--”,并且必须小于 32 个字符。

--resource-group -g

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

--subscription

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

全局参数
--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 获取完整的调试日志。