我正试图在powershell中创建一个azsphere租户。登录到azsphere CLI之后,运行以下命令:
azsphere租户创建-名称MyTenant -强制-附加
我确认并得到错误消息:
由于参数无效,
命令失败。检查所提供的值,然后再试一次。Azure Sphere安全服务发送了以下消息:错误请求
我试着用另一个房客的名字,在网上查了这个问题,没有任何结果。
编辑:当我使用--调试和-详细的参数运行命令时,我会得到有关错误的其他信息。我会把所有的信息都贴在这里。
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)发布于 2022-06-10 08:32:21
转到用sdk下载的命令提示符,然后从那里安装。
然后是azsphere tenant create --name MyTenant
会起作用的。对我来说很管用
https://stackoverflow.com/questions/71407547
复制相似问题