【发布时间】:2022-06-14 11:56:13
【问题描述】:
我正在尝试在 powershell 中创建一个 azsphere 租户。登录 azsphere CLI 后,我运行以下命令:
azsphere 租户创建 --name MyTenant --force-additional
我确认并收到错误消息:
由于参数无效,命令失败。检查您提供的值,然后重试。 Azure Sphere 安全服务发送了以下消息:错误请求
我尝试使用另一个租户名称并在网上查找问题没有任何成功
编辑:当我使用 --debug 和 --verbose 参数运行命令时,我会获得有关错误的其他信息。我会将所有信息粘贴在这里。
cli.azure.cli.core.sdk.policies: Request URL: 'https://prod.core.sphere.azure.net/v2/tenants/create'
cli.azure.cli.core.sdk.policies: Request method: 'POST'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Client-SDK': 'azsphere_v2'
cli.azure.cli.core.sdk.policies: 'Client-SDK-Version': '22.02'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '34'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '554eede3-9f9e-11ec-8137-3868938df738'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'azsdk-python-sphere-publicapi/0.4.3 Python/3.8.9 (Windows-10-10.0.22000-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"TenantFriendlyName": "MyTenant"}
urllib3.connectionpool: https://prod.core.sphere.azure.net:443 "POST /v2/tenants/create HTTP/1.1" 400 132
cli.azure.cli.core.sdk.policies: Response status: 400
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Date': 'Wed, 09 Mar 2022 11:44:37 GMT'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Length': '132'
cli.azure.cli.core.sdk.policies: 'Request-Context': 'appId='
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'api-supported-versions': '2.0'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: "Exception of type 'Azure.Sphere.Services.PublicApi.Service.Handlers.Implementation.HandlerExceptionWithHttpStatusCode' was thrown."
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_cloudmanagement/tenant/custom.py", line 94, in create_tenant
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_cloudmanagement/tenant/custom.py", line 106, in create_tenant_request
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/async_wrapper.py", line 73, in wrapped_operation
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/publicapi/operations/_tenants_operations.py", line 142, in create
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'
Content: "Exception of type 'Azure.Sphere.Services.PublicApi.Service.Handlers.Implementation.HandlerExceptionWithHttpStatusCode' was thrown."
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 712, in _run_job
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azext_sphere_cloudmanagement/_exception_handler.py", line 192, in tenant_create_exception_handler
File "D:\a\_work\1\s\azsphere-cli\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/sphere/cli/core/cloud_exception_handler.py", line 148, in cloud_exception_handler
knack.util.CLIError: Command failed due to invalid parameters. Check the values you provided and try again.
The Azure Sphere Security Service sent the following message: Bad Request
cli.azure.cli.core.azclierror: Command failed due to invalid parameters. Check the values you provided and try again.
The Azure Sphere Security Service sent the following message: Bad Request
az_command_data_logger: Command failed due to invalid parameters. Check the values you provided and try again.
The Azure Sphere Security Service sent the following message: Bad Request
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x03B125C8>, <function CompleterCache.invalidate_cache at 0x043B2610>]
az_command_data_logger: exit code: 1
cli.__main__: Azure Sphere Utility version 22.02.3.34006
cli.__main__: Command ran in 9.497 seconds (init: 1.297, invoke: 8.200)
【问题讨论】:
-
请问您是尝试新建 az sphere 租户,还是尝试使用旧帐户创建新租户
-
@SaiSakethGuduru-MT 我是使用 azsphere 的新手,我不确定我是否理解“尝试新创建 az sphere 租户”的意思,但我正在尝试使用创建我的第一个租户附加设备“Azure Sphere Mt3620”。
-
@TageDanielsson:您是否尝试过列出租户,看看是否可行?可能已经有一个具有该名称的租户,或者发生了一些连接问题。 "azsphere 租户列表"
-
如果是这种情况,那么您可能只使用 ** azsphere tenant create --name MyTenant ** 而不是 --force--additional 如果您已经有租户并确定您想要另一个,请使用 --force-additional 参数。
-
@SaiSakethGuduru-MT 当我在没有 --force-additional 的情况下运行命令时,我得到了同样的错误。当我运行“azsphere 租户列表”时,没有任何反应。我想这意味着我没有租户。
标签: azure bad-request