lib/publiccloud/azure.pm

decode_azure_json

    my $json_obj = decode_azure_json($str);

Helper function to decode json string, retrieved from az, into a json object. Due to https://github.com/Azure/azure-cli/issues/9903 we need to strip all color codes from that string first.

my $parsed_id = $self->parse_instance_id($instance); say $parsed_id->{vm_name}; say $parsed_id->{resource_group};

Extract resource group and vm name from full instance id which looks like /subscriptions/c011786b-59d7-4817-880c-7cd8a6ca4b19/resourceGroups/openqa-suse-de-1ec3f5a05b7c0712/providers/Microsoft.Compute/virtualMachines/openqa-suse-de-1ec3f5a05b7c0712