Closed BCOps closed 2 years ago
Compute
@cxznmhdcxz @zhoxing-ms - Is there anyone available to provide advice on this at all? I'm hoping it's just a quick answer to close it off...
Hello @BCOps, we are troubleshooting the issue. Could you please provide your debug infomation for the command reported error? Debug information could be acquired by adding parameter --debug
in your executed command. Thanks.
@yanzhudd - No problem, please find below:
PS C:\temp> az vm run-command create --run-command-name $commandName `
--vm-name $vm.name `
--resource-group $vm.resourceGroup `
--async-execution false `
--timeout-in-seconds 60 `
--parameters "param1=foo" `
--protected-parameters "param2=bar" `
--script "@script.ps1" `
--debug
cli.knack.cli: Command arguments: ['vm', 'run-command', 'create', '--run-command-name', 'test_20220711_084630', '--vm-name', 'fsmsjgzlwblgy', '--resource-group', 'Spoke-cdevtst11-Acc-SS', '--async-execution', 'false', '--timeout-in-second
s', '60', '--parameters', 'param1=foo', '--protected-parameters', 'param2=bar', '--script', '@script.ps1', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0243DCD0>, <function OutputProducer.on_global_arguments at 0x025FC610>, <function CLIQuery.on_global_arguments at 0x0261A268>]
cli.azure.cli.core.util: attempting to read file script.ps1 as utf-8-sig
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'vm': ['azure.cli.command_modules.vm']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: vm 0.232 55 289
cli.azure.cli.core: Total (1) 0.232 55 289
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: Loaded 55 groups, 289 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : vm run-command create
cli.azure.cli.core: Command table: vm run-command create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x049B2EC8>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\bcarver\.azure\commands\2022-07-11.09-48-42.vm_run-command_create.12164.log'.
az_command_data_logger: command args: vm run-command create --run-command-name {} --vm-name {} --resource-group {} --async-execution {} --timeout-in-seconds {} --parameters {} --protected-parameters {} --script {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x049EAB68>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x049EABF8>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x049FE190>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x025FC658>, <function CLIQuery.handle_query_parameter at 0x0261A2B0>, <function register_ids_argument.<locals>.parse_ids_arguments a
t 0x049FE148>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\bcarver\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\bcarver\.azure\msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secr
et_basic'], 'jwks_uri': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 10d7994d-fadd-4a34-b3f2-a9c95031a5db
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourcegroups/Spoke-cdevtst11-Acc-SS?api-version=2021-04-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44355460-00f6-11ed-a123-80325362e8f4'
cli.azure.cli.core.sdk.policies: 'CommandName': 'vm run-command create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--run-command-name --vm-name --resource-group --async-execution --timeout-in-seconds --parameters --protected-parameters --script --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.38.0 (MSI) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.10.5 (Windows-10-10.0.18363-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourcegroups/Spoke-cdevtst11-Acc-SS?api-version=2021-04-01 HTTP/1.1" 200 537
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11997'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '60e39b2d-c138-4ffa-8389-7d0444f97a21'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '60e39b2d-c138-4ffa-8389-7d0444f97a21'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKWEST:20220711T084843Z:60e39b2d-c138-4ffa-8389-7d0444f97a21'
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: 'Date': 'Mon, 11 Jul 2022 08:48:42 GMT'
cli.azure.cli.core.sdk.policies: 'Content-Length': '537'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"id":"/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS","name":"Spoke-cdevtst11-Acc-SS","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"cd
o:cost:business-unit":"Planning and Operations","cdo:cost:primary-segment":"Trading Planning and Scheduling","cdo:cost:secondary-segment":"Spiral","cdo:cost:csr-name":"AVEVA Unified Supply Chain","cdo:cost:customer-name":"cdevtst11","cdo:cost:primary-function":"License CoS","cdo:cost:secondary-function":"License CoS","cdo:cost:region":"Americas","cdo:cost:market":"Americas HQ","cdo:cost:environment":"Development","cdo:cost:stage":"Development","Function":"Spoke","Client":"cdevtst11","Environment":"Acc","Role":"SS","Package":"2022.3.55"},"properties":{"provisioningState":"Succeeded"}}
cli.azure.cli.core.commands.validators: using location 'westus' from resource group 'Spoke-cdevtst11-Acc-SS'
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ComputeManagementClient
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secr
et_basic'], 'jwks_uri': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/f73e5106-9d94-4cbb-9af3-54dd3909bda9/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: ba99c84e-2b24-4f05-87d8-710152c71478
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/tes
t_20220711_084630?api-version=2022-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'PUT'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '432'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json, text/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44355460-00f6-11ed-a123-80325362e8f4'
cli.azure.cli.core.sdk.policies: 'CommandName': 'vm run-command create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--run-command-name --vm-name --resource-group --async-execution --timeout-in-seconds --parameters --protected-parameters --script --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.38.0 (MSI) azsdk-python-azure-mgmt-compute/27.1.0 Python/3.10.5 (Windows-10-10.0.18363-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"location": "westus", "properties": {"source": {"script": "param (\r\n [string]\r\n $param1,\r\n\r\n [string]\r\n $param2\r\n)\r\nStart-Transcript\r\nWrite-Host \"Do I have param1? $param1\"\r
\nWrite-Host \"Do I have param2? $param2\"\r\nStop-Transcript"}, "parameters": [{"name": "param1", "value": "foo"}], "protectedParameters": [{"name": "param1", "value": "foo"}], "asyncExecution": false, "timeoutInSeconds": 60}}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/test_20220711_08
4630?api-version=2022-03-01 HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies: 'Azure-AsyncOperation': 'https://management.azure.com/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/providers/Microsoft.Compute/locations/westus/operations/7f543c5a-059f-43d3-9dfd-df9cdaf91185?p=a
86147de-d3f2-461d-a452-620d2840c49c&api-version=2022-03-01'
cli.azure.cli.core.sdk.policies: 'Azure-AsyncNotification': 'Enabled'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '7f543c5a-059f-43d3-9dfd-df9cdaf91185'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1199'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'a027abb1-90b0-4462-a0b1-45febf6dd5d8'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKWEST:20220711T084844Z:a027abb1-90b0-4462-a0b1-45febf6dd5d8'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 11 Jul 2022 08:48:43 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {
"name": "test_20220711_084630",
"id": "/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/test_20220711_084630",
"type": "Microsoft.Compute/virtualMachines/runCommands",
"location": "westus",
"properties": {
"source": {
"script": "param (\r\n [string]\r\n $param1,\r\n\r\n [string]\r\n $param2\r\n)\r\nStart-Transcript\r\nWrite-Host \"Do I have param1? $param1\"\r\nWrite-Host \"Do I have param2? $param2\"\r\nStop-Transcript"
},
"parameters": [
{
"name": "param1",
"value": "foo"
}
],
"timeoutInSeconds": 60,
"provisioningState": "Updating",
"asyncExecution": false
}
}
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/providers/Microsoft.Compute/locations/westus/operations/7f543c5a-059f-43d3-9dfd-df9cdaf91185?p=a86147de-d3f2-46
1d-a452-620d2840c49c&api-version=2022-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44355460-00f6-11ed-a123-80325362e8f4'
cli.azure.cli.core.sdk.policies: 'CommandName': 'vm run-command create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--run-command-name --vm-name --resource-group --async-execution --timeout-in-seconds --parameters --protected-parameters --script --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.38.0 (MSI) azsdk-python-azure-mgmt-compute/27.1.0 Python/3.10.5 (Windows-10-10.0.18363-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/providers/Microsoft.Compute/locations/westus/operations/7f543c5a-059f-43d3-9dfd-df9cdaf91185?p=a86147de-d3f2-461d-a452-620d2
840c49c&api-version=2022-03-01 HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-resource': 'Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29993'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'c8f7cd6d-4609-4192-9f2c-546535a73fde'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11999'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'a4bd7765-006b-4efd-b41e-58da21eec25d'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKWEST:20220711T084914Z:a4bd7765-006b-4efd-b41e-58da21eec25d'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 11 Jul 2022 08:49:13 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {
"startTime": "2022-07-11T08:48:43.8559637+00:00",
"endTime": "2022-07-11T08:48:44.4028259+00:00",
"status": "Succeeded",
"name": "7f543c5a-059f-43d3-9dfd-df9cdaf91185"
}
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/tes
t_20220711_084630?api-version=2022-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44355460-00f6-11ed-a123-80325362e8f4'
cli.azure.cli.core.sdk.policies: 'CommandName': 'vm run-command create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--run-command-name --vm-name --resource-group --async-execution --timeout-in-seconds --parameters --protected-parameters --script --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.38.0 (MSI) azsdk-python-azure-mgmt-compute/27.1.0 Python/3.10.5 (Windows-10-10.0.18363-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/test_20220711_08
4630?api-version=2022-03-01 HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '661012f8-3388-49ad-9cf0-eb59a4dc50b8'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11998'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '0ad7d7a0-1fac-4b9c-855f-8909dbc4b1cd'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKWEST:20220711T084914Z:0ad7d7a0-1fac-4b9c-855f-8909dbc4b1cd'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 11 Jul 2022 08:49:13 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {
"name": "test_20220711_084630",
"id": "/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/test_20220711_084630",
"type": "Microsoft.Compute/virtualMachines/runCommands",
"location": "westus",
"properties": {
"source": {
"script": "param (\r\n [string]\r\n $param1,\r\n\r\n [string]\r\n $param2\r\n)\r\nStart-Transcript\r\nWrite-Host \"Do I have param1? $param1\"\r\nWrite-Host \"Do I have param2? $param2\"\r\nStop-Transcript"
},
"parameters": [
{
"name": "param1",
"value": "foo"
}
],
"timeoutInSeconds": 60,
"provisioningState": "Succeeded",
"asyncExecution": false
}
}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x049E3F58>, <function _x509_from_base64_to_hex_transform at 0x049E3FA0>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
"asyncExecution": false,
"errorBlobUri": null,
"id": "/subscriptions/4ea0e3b2-456a-4baa-8fc3-382e7add362c/resourceGroups/Spoke-cdevtst11-Acc-SS/providers/Microsoft.Compute/virtualMachines/fsmsjgzlwblgy/runCommands/test_20220711_084630",
"instanceView": null,
"location": "westus",
"name": "test_20220711_084630",
"outputBlobUri": null,
"parameters": [
{
"name": "param1",
"value": "foo"
}
],
"protectedParameters": null,
"provisioningState": "Succeeded",
"resourceGroup": "Spoke-cdevtst11-Acc-SS",
"runAsPassword": null,
"runAsUser": null,
"source": {
"commandId": null,
"script": "param (\r\n [string]\r\n $param1,\r\n\r\n [string]\r\n $param2\r\n)\r\nStart-Transcript\r\nWrite-Host \"Do I have param1? $param1\"\r\nWrite-Host \"Do I have param2? $param2\"\r\nStop-Transcript",
"scriptUri": null
},
"tags": null,
"timeoutInSeconds": 60,
"type": "Microsoft.Compute/virtualMachines/runCommands"
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x049B4028>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 32.807 seconds (init: 0.463, invoke: 32.344)
telemetry.save: Save telemetry record of length 3104 in cache
The command itself appears to run OK, but when you review the result file in the VM itself you can see the failure:
[{"version":"1","timestampUTC":"2022-07-11T08:46:45.7640396Z","status":{"name":"test_20220711_084630","operation":"RunCommand script execution completed","status":"success","code":0,"formattedMessage":{"lang":"en-US","message":"{\"executionMessage\":null,\"output\":null,\"exitCode\":1,\"error\":\"C:\\\\Packages\\\\Plugins\\\\Microsoft.CPlat.Core.RunCommandHandlerWindows\\\\2.0.3\\\\Downloads\\\\Script_test_20220711_084630_0.ps1 : \\nCannot bind parameter because parameter 'param1' is specified more than once. To provide multiple values to parameters \\nthat can accept multiple values, use the array syntax. For example, \\\"-parameter value1,value2,value3\\\".\\n + CategoryInfo : InvalidArgument: (:) [Script_test_20220711_084630_0.ps1], ParentContainsErrorRecordExcep \\n tion\\n + FullyQualifiedErrorId : ParameterAlreadyBound,Script_test_20220711_084630_0.ps1\\n \",\"startTime\":\"2022-07-11T08:46:45.1077819+00:00\",\"endTime\":\"2022-07-11T08:46:45.7640396+00:00\",\"executionState\":\"Failed\"}"},"substatus":null}}]
The command itself appears to run OK, but when you review the result file in the VM itself you can see the failure:
[{"version":"1","timestampUTC":"2022-07-11T08:46:45.7640396Z","status":{"name":"test_20220711_084630","operation":"RunCommand script execution completed","status":"success","code":0,"formattedMessage":{"lang":"en-US","message":"{\"executionMessage\":null,\"output\":null,\"exitCode\":1,\"error\":\"C:\\\\Packages\\\\Plugins\\\\Microsoft.CPlat.Core.RunCommandHandlerWindows\\\\2.0.3\\\\Downloads\\\\Script_test_20220711_084630_0.ps1 : \\nCannot bind parameter because parameter 'param1' is specified more than once. To provide multiple values to parameters \\nthat can accept multiple values, use the array syntax. For example, \\\"-parameter value1,value2,value3\\\".\\n + CategoryInfo : InvalidArgument: (:) [Script_test_20220711_084630_0.ps1], ParentContainsErrorRecordExcep \\n tion\\n + FullyQualifiedErrorId : ParameterAlreadyBound,Script_test_20220711_084630_0.ps1\\n \",\"startTime\":\"2022-07-11T08:46:45.1077819+00:00\",\"endTime\":\"2022-07-11T08:46:45.7640396+00:00\",\"executionState\":\"Failed\"}"},"substatus":null}}]
Okay, we will check it.
Hello @BCOps, we fix some relevant content. You can use a private package in blow link to check if it meets your expectations.
@yanzhudd - Yes I can confirm this behaves as expected. I can now access regular and protected parameters as desired. Protected parameters are also not exposed in the settings file on the VM, also as expected. It looks like #23175 will fix the issue correctly. Thank you!
@yanzhudd - Yes I can confirm this behaves as expected. I can now access regular and protected parameters as desired. Protected parameters are also not exposed in the settings file on the VM, also as expected. It looks like #23175 will fix the issue correctly. Thank you!
Okay, glad this modification can meet your expectations. Yes, we will fix it in #23175.
I am trying to run a command using az vm run-command create (as per https://docs.microsoft.com/en-us/cli/azure/vm/run-command?view=azure-cli-latest#az-vm-run-command-create) . I am running this on a Windows 10 workstation, communicating with a Windows Server VM in Azure, where I wish to run a remote PowerShell script.
I am trying to understand how to access the parameters that I pass in via the az cli command. Usually for the "invoke" equivalent, I would just add the parameters switch and then they would be accessible to the remote VM where I run the command via a param block, i.e.:
az vm run-command invoke:
PowerShell script:
This works just fine, however I want to leverage the additional functionality of the new az vm run-command create commands to access protected params as well as the timeout element. If I run the same script using this format, it does not give me the parameters as I expect:
az vm run-command create:
Output returned is:
Thinking that this means the az cli command is automatically creating params for me, I have tried removing the param block from the PowerShell script. This does not work (though it does remove the error and completes with a success status), as I do not see any param values:
Output returned is:
Would I be able to ask for some guidance on how I can correctly provide params to a PowerShell script being executed and/or adjust my PowerShell script to access these params? I have reviewed the documentation but the only info on params is "The parameters used by the script". Thanks.
az version output is as follows for reference: