azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az vmss diagnostics set --resource-group <rg> --vmss-name <vmss> --settings router_config.json --protected-settings protected.json gives error The value of parameter type is invalid.

Open anaik91 opened this issue 6 years ago • 21 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.2.0-1

Describe the bug az vmss diagnostics set cli gives error"The value of parameter type is invalid."

To Reproduce Steps to reproduce the behavior. Run the command

  • az vmss diagnostics set --resource-group --vmss-name --settings router_config.json --protected-settings protected.json

Expected behavior Enable LinuxDiagnostic on VM scale set

Environment summary Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

Docker container - VERSION=" Ubuntu 18.04.4 LTS (Bionic Beaver)"

Additional context Add any other context about the problem here.

It used to work on a older version of az cli 2.0.66

anaik91 avatar Mar 15 '20 20:03 anaik91

hi @qwordy , could you pls help to look at it? thanks.

yungezz avatar Mar 16 '20 01:03 yungezz

This may be a related issue: https://github.com/MicrosoftDocs/azure-docs/issues/50180

naman1901 avatar Mar 16 '20 14:03 naman1901

I'm observing same issue for az vmss extension set --vmss-name akswin1 --resource-group MC_something --publisher Microsoft.Powershell --name DSC --version 2.9.1 --settings @./settings.json --protected-settings @./psettings.json --force-update when running that in Azure Cloud Shell.

Version info:

{
  "azure-cli": "2.2.0",
  "azure-cli-command-modules-nspkg": "2.0.3",
  "azure-cli-core": "2.2.0",
  "azure-cli-nspkg": "3.0.4",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {
    "aks-preview": "0.4.35",
    "front-door": "1.0.3",
    "resource-graph": "1.0.0"
  }
}

wasker avatar Mar 18 '20 23:03 wasker

Looks like Azure CLI version 2.2.0 forgot to pass the extension's type to the underlying Resource Provider.

eg. with CLI 2.1.0 "extensions": [ { "name": "customScript", "properties": { "autoUpgradeMinorVersion": true, "publisher": "Microsoft.Azure.Extensions", "type": "CustomScript", "typeHandlerVersion": "2.0", "settings": {"commandToExecute":"echo testing"} }

and with CLI 2.2.0 "extensions": [ { "name": "customScript", "properties": { "autoUpgradeMinorVersion": true, "publisher": "Microsoft.Azure.Extensions", "typeHandlerVersion": "2.0", "settings": {"commandToExecute":"echo testing"} }

axelgMS avatar Mar 20 '20 13:03 axelgMS

Is there a known fix? Can the type be set or passed from the cli interface?

hrishioa avatar Mar 22 '20 10:03 hrishioa

@hrishioa I was able to perform the operation using powershell. You can set the type version as shown below: Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name "customScript" -Publisher "Microsoft.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion 1.9 -Setting $customConfig For more information you can look at https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/tutorial-install-apps-powershell

lalitadithya avatar Mar 22 '20 10:03 lalitadithya

@lalitadithya Thanks! Is there a way to add a type to azure-cli? There doesn't seem to be a type parameter mentioned in the reference. I'll try using powershell for now.

hrishioa avatar Mar 22 '20 10:03 hrishioa

@hrishioa No. I couldn't find anything to add a type parameter to the azure-cli command. I spent all morning trying to add a script extension to my VMSS using the azure cli. It is rather unfortunate that there is no way to download a previous release of the cli. As far as I can tell, the only way to do it (before a patch is released) would be to use powershell or an ARM template or by calling the REST API documented at https://docs.microsoft.com/en-us/rest/api/compute/virtualmachinescalesets.

lalitadithya avatar Mar 22 '20 10:03 lalitadithya

@lalitadithya thanks anyway!

hrishioa avatar Mar 22 '20 10:03 hrishioa

Similar issue: #12672

qwordy avatar Mar 22 '20 13:03 qwordy

I have opened a PR to fix this issue. The root cause is that Python SDK abandoned type. Instead, it uses type1 now. I am very confused why there is such kind of change!!!

    def __init__(self, *, name: str=None, force_update_tag: str=None, publisher: str=None, type1: str=None, type_handler_version: str=None, auto_upgrade_minor_version: bool=None, settings=None, protected_settings=None, provision_after_extensions=None, **kwargs) -> None:
        super(VirtualMachineScaleSetExtension, self).__init__(**kwargs)
        self.name = name
        self.type = None
        self.force_update_tag = force_update_tag
        self.publisher = publisher
        self.type1 = type1

qwordy avatar Mar 22 '20 14:03 qwordy

The fix will be available in next version of Azure CLI. Release date is 3/31/2020.

qwordy avatar Mar 24 '20 02:03 qwordy

I have the same issue with CLI 2.2.0, see also at https://github.com/MicrosoftDocs/azure-docs/issues/50180

az vmss extension set
--resource-group $managed_rg
--vmss-name $vmss_name
--name VMAccessForLinux
--publisher Microsoft.OSTCExtensions
--version 1.4
--verbose
--debug
--protected-settings "{"username":"azureuser", "ssh_key":"$(cat ~/.ssh/id_rsa_aks_vm.pub)"}"

az --version azure-cli 2.2.0

command-modules-nspkg 2.0.3 core 2.2.0 nspkg 3.0.4 telemetry 1.0.4

Extensions: aks-preview 0.4.38 azure-firewall 0.3.0

Python location '/opt/az/bin/python3' Extensions directory '/home/pinpin/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Mar 6 2020, 14:41:24) [GCC 7.4.0]

Legal docs and information: aka.ms/AzureCliLegal

ezYakaEagle442 avatar Mar 30 '20 10:03 ezYakaEagle442

Azure CLI 2.3.0 is released. It fixes this issue. Download it and have a try. Close the issue now. https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

qwordy avatar Mar 31 '20 06:03 qwordy

I am still having issue with version 2.3.1 (installed via apt on Debian)

az vmss extension set  \
    --resource-group $CLUSTER_RESOURCE_GROUP \
    --vmss-name $SCALE_SET_NAME \
    --name VMAccessForLinux \
    --publisher Microsoft.OSTCExtensions \
    --version 1.4 \
    --protected-settings "{\"username\":\"azureuser\", \"ssh_key\":\"$(cat ~/.ssh/id_rsa.pub)\"}"
Invalid control character at: line 1 column 435 (char 434)

Running the above with --debug

Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f39f2465b70>]
az_command_data_logger : command args: --debug {} {} {} --resource-group {} --vmss-name {} --name {} --publisher {} --version {} --protected-settings {} {} {}
metadata file logging enabled - writing logs to '/home/aneagu/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f39f24848c8>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f39f243a730>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f39f243a8c8>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7f39f05e7268>]
cli.azure.cli.core.parser : az vmss: 'extension' is not in the 'az vmss' command group. See 'az vmss --help'. If the command is from an extension, please make sure the corresponding extension is installed. To learn more about extensions, please visit https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
az vmss: 'extension' is not in the 'az vmss' command group. See 'az vmss --help'. If the command is from an extension, please make sure the corresponding extension is installed. To learn more about extensions, please visit https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
az_command_data_logger : exit code: 2
telemetry.save : Save telemetry record of length 2841 in cache
az --version
azure-cli                          2.3.1

acr                                2.2.1 *
acs                               2.3.18 *
advisor                            2.0.0 *
ams                                0.4.2 *
appservice                        0.2.14 *
backup                             1.2.1 *
batch                              4.0.0 *
batchai                            0.4.7 *
billing                            0.2.0 *
botservice                         0.1.7 *
cdn                                0.2.0 *
cloud                              2.1.0 *
cognitiveservices                  0.2.4 *
command-modules-nspkg              2.0.3
configure                         2.0.20 *
consumption                        0.4.2 *
container                         0.3.14 *
core                               2.3.1
cosmosdb                           0.2.8 *
dla                                0.2.4 *
dls                                0.1.8 *
dms                                0.1.2 *
eventgrid                          0.2.1 *
eventhubs                          0.3.3 *
extension                          0.2.3 *
feedback                           2.1.4 *
find                              0.2.13 *
hdinsight                          0.3.1 *
interactive                        0.4.1 *
iot                                0.3.6 *
iotcentral                         0.1.6 *
keyvault                          2.2.12 *
kusto                              0.2.0 *
lab                                0.1.5 *
maps                               0.3.3 *
monitor                           0.2.10 *
network                            2.3.3 *
nspkg                              3.0.4
policyinsights                     0.1.1 *
profile                            2.1.3 *
rdbms                              0.3.7 *
redis                              0.4.1 *
relay                              0.1.3 *
reservations                       0.4.1 *
resource                          2.1.11 *
role                               2.4.1 *
search                             0.1.1 *
security                           0.1.0 *
servicebus                         0.3.3 *
servicefabric                     0.1.13 *
signalr                            1.0.0 *
sql                                2.1.9 *
sqlvm                              0.1.0 *
storage                            2.3.1 *
telemetry                          1.0.4
vm                                2.2.16 *

Extensions:
aks-preview                       0.4.42
interactive                        0.4.1

Python location '/opt/az/bin/python3'
Extensions directory '/home/aneagu/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Apr  1 2020, 07:20:06)
[GCC 6.3.0 20170516]

aronneagu avatar Apr 03 '20 18:04 aronneagu

I just hit the same bug in Azure Cloud Shell. az vmss extension set --resource-group .....

The value of parameter type is invalid.

Instructions at https://docs.microsoft.com/en-us/azure/aks/ssh seem to be broken !

diepes avatar Apr 22 '20 12:04 diepes

@diepes - unfortunately CloudShell doesn't include the latest CLI version with the fix. This should be deployed in ~2 weeks from what I hear.

axelgMS avatar Apr 22 '20 12:04 axelgMS

+1 to @axelgMS, Cloud Shell users can tell that there is a delay before a latest CLI release gets rolled out to Azure Cloud Shell, and the delay is normally 1 or 2 weeks. However, users do not get notified when a new release is ready in the Azure Cloud Shell.

If Azure provides the users an option to subscribe to notifications when a new release of CLI is or is scheduled to be rolled out to the Azure Cloud Shell, it will be very helpful.

haokanga avatar Apr 22 '20 15:04 haokanga

@aronneagu It is a different error of this issue.

az vmss: 'extension' is not in the 'az vmss' command group

What's the output of az vmss -h in your environment?

qwordy avatar Apr 23 '20 02:04 qwordy

@aronneagu Any update?

qwordy avatar Jul 01 '20 02:07 qwordy