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

az iot ops broker authn

注释

此参考是 Azure CLI(版本 2.53.0 或更高版本)的 azure-iot-ops 扩展的一部分。 该扩展将在首次运行 az iot ops broker authn 命令时自动安装。 了解更多关于扩展 的相关信息。

Mqtt 中转站身份验证管理。

命令

名称 说明 类型 Status
az iot ops broker authn apply

创建或替换 mqtt 代理身份验证资源。

扩展 乔治亚州
az iot ops broker authn delete

删除 mqtt 代理身份验证资源。

扩展 乔治亚州
az iot ops broker authn list

列出与代理关联的 mqtt 代理身份验证资源。

扩展 乔治亚州
az iot ops broker authn method

Mqtt broker 身份验证方法作。

扩展 乔治亚州
az iot ops broker authn method add

将身份验证方法添加到 mqtt 中转站身份验证资源。

扩展 乔治亚州
az iot ops broker authn show

显示 mqtt 代理身份验证资源的详细信息。

扩展 乔治亚州

az iot ops broker authn apply

创建或替换 mqtt 代理身份验证资源。

配置文件格式的示例如下所示:

{
    "authenticationMethods": [
        {
            "method": "Custom",
            "customSettings": {
                "endpoint": "https://auth-server-template",
                "caCertConfigMap": "custom-auth-ca",
                "auth": {
                    "x509": {
                        "secretRef": "custom-auth-client-cert"
                    }
                },
                "headers": {
                    "header_key": "header_value"
                }
            }
        },
        {
            "method": "ServiceAccountToken",
            "serviceAccountTokenSettings": {
                "audiences": [
                    "aio-internal",
                    "my-audience"
                ]
            }
        },
        {
            "method": "X509",
            "x509Settings": {
                "trustedClientCaCert": "client-ca",
                "authorizationAttributes": {
                    "root": {
                        "attributes": {
                            "organization": "contoso"
                        },
                        "subject": "CN = Contoso Root CA Cert, OU = Engineering, C = US"
                    },
                    "intermediate": {
                        "attributes": {
                            "city": "seattle",
                            "foo": "bar"
                        },
                        "subject": "CN = Contoso Intermediate CA"
                    },
                    "smartfan": {
                        "attributes": {
                            "building": "17"
                        },
                        "subject": "CN = smart-fan"
                    }
                }
            }
        }
    ]
}

在应用上述内容时,将创建或替换配置有三种身份验证方法的目标身份验证资源。

az iot ops broker authn apply --config-file
                              --instance
                              --name
                              --resource-group
                              [--broker]

示例

使用配置文件为默认中转站创建或替换身份验证资源。

az iot ops broker authn apply -n authn --in myinstance -g myresourcegroup --config-file /path/to/authn/config.json

必需参数

--config-file

包含 json 格式的资源属性的配置文件的路径。 配置文件应包含与资源的 ARM 表示形式兼容的属性的对象。 该对象直接与 ARM 资源的“properties:{}”相关联。

--instance -i

IoT 操作实例名称。

--name -n

Mqtt 中转站身份验证资源名称。

--resource-group -g

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

可选参数

--broker -b

Mqtt 中转站名称。

默认值: 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 iot ops broker authn delete

删除 mqtt 代理身份验证资源。

az iot ops broker authn delete --instance
                               --name
                               --resource-group
                               [--broker]
                               [--yes {false, true}]

示例

删除与默认代理关联的名为“authn”的代理身份验证资源。

az iot ops broker authn delete -n authn --in myinstance -g myresourcegroup

与前面的示例相同,但跳过确认提示。

az iot ops broker authn delete -n authn --in myinstance -g myresourcegroup -y

必需参数

--instance -i

IoT 操作实例名称。

--name -n

Mqtt 中转站身份验证资源名称。

--resource-group -g

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

可选参数

--broker -b

Mqtt 中转站名称。

默认值: default
--yes -y

在没有提示的情况下确认 [y]es。 适用于 CI 和自动化方案。

接受的值: false, true
全局参数
--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 iot ops broker authn list

列出与代理关联的 mqtt 代理身份验证资源。

az iot ops broker authn list --instance
                             --resource-group
                             [--broker]

示例

枚举与默认代理关联的所有代理身份验证资源。

az iot ops broker authn list --in myinstance -g myresourcegroup

必需参数

--instance -i

IoT 操作实例名称。

--resource-group -g

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

可选参数

--broker -b

Mqtt 中转站名称。

默认值: 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 iot ops broker authn show

显示 mqtt 代理身份验证资源的详细信息。

az iot ops broker authn show --instance
                             --name
                             --resource-group
                             [--broker]

示例

显示与默认代理关联的默认身份验证资源的详细信息。

az iot ops broker authn show -n authn --in myinstance -g myresourcegroup

必需参数

--instance -i

IoT 操作实例名称。

--name -n

Mqtt 中转站身份验证资源名称。

--resource-group -g

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

可选参数

--broker -b

Mqtt 中转站名称。

默认值: 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 获取完整的调试日志。