From e85c3797e3e73621eaa456abd281c653a934f110 Mon Sep 17 00:00:00 2001 From: jasonmcgilloway Date: Tue, 14 Feb 2023 21:55:48 +0000 Subject: [PATCH] user tag added to addproc --- src/AzManagers.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/AzManagers.jl b/src/AzManagers.jl index 0a82774a..5fc8e6f9 100644 --- a/src/AzManagers.jl +++ b/src/AzManagers.jl @@ -1743,7 +1743,7 @@ function scaleset_create_or_update(manager::AzManager, user, subscriptionid, res _e = JSONWebTokens.None() _decoded = JSONWebTokens.decode(_e, _t) _user = _decoded["unique_name"] - _template["tags"] = Dict("UserEmail"=>_user) + _template["tags"] = Dict("UserUniqueName"=>_user) key = Dict("path" => "/home/$user/.ssh/authorized_keys", "keyData" => read(ssh_key, String)) push!(_template["properties"]["virtualMachineProfile"]["osProfile"]["linuxConfiguration"]["ssh"]["publicKeys"], key) @@ -2229,6 +2229,14 @@ function addproc(vm_template::Dict, nic_template=nothing; vmname = name == "" ? basename*"-"*randstring('a':'z', 6) : name nicname = vmname*"-nic" + _t = token(session) + _e = JSONWebTokens.None() + _decoded = JSONWebTokens.decode(_e, _t) + if haskey(_decoded, "unique_name") + _user = _decoded["unique_name"] + vm_template["value"]["tags"] = Dict("UserUniqueName"=>_user) + end + if nic_template == nothing isfile(templates_filename_nic()) || error("if nic_template==nothing, then the file $(templates_filename_nic()) must exist. See AzManagers.save_template_nic.") nic_templates = JSON.parse(read(templates_filename_nic(), String))