I'm currently building out a number of virtual machines in azure using a template that we've built out. I would like to be able to pull the name of the user who chose to deploy this template so that we can verify a number of things exist on the server for them (i.e. userid). Is there anyway to do this? Any help would be appreciated.
Asked
Active
Viewed 538 times
1 Answers
2
No, this is not possible using arm templates (unless using some pretty horrible\unreliable\outside of arm template hacks).
You could probably work around that by creating a parameter where user inputs his details, but even that the second part of your plan will fail. You cannot really do checks on the OS level configurations from the template.
ARM templates aren't meant to actually check things, and while some interactions are possible, they are very limited (like listKeys).

4c74356b41
- 69,186
- 6
- 100
- 141
-
I was more thinking of pulling the deployment username and then passing it to my custom script. – lazuhrus Aug 12 '17 at 02:14
-
you can do that, but again, arm templates cannot check whats in the vm and adjust it accordingly – 4c74356b41 Aug 12 '17 at 06:12
-
Correct. So maybe my wording was a little misleading. What I'm actually looking for is how to pull the deployment name and then pass it to my custom script to have that script take certain actions. So the question now is, how do I go about pulling that deployment username? – lazuhrus Aug 12 '17 at 14:26
-
are you deploying using powershell? – 4c74356b41 Aug 12 '17 at 15:09
-
I'm trying to make it as easy as possible on the end users, so I'd like them to either use the portal (open the template in the GUI and then click deploy) or have something pinned to their initial dashboard where they can just click and run. At a minimum though I figure I can at least give them the commands they can run in the cloud shell, but again.. trying to make this as error proof as possible. – lazuhrus Aug 12 '17 at 21:19
-
i don't think there is a way using the portal, you might want to look at UI functions for arm templates (that is if you will publish a managed app, copy\pasting the template into portal editor won't do the trick). with any sort of shell it is up to you to code something to get current user data and inject it into template. – 4c74356b41 Aug 14 '17 at 07:39
-
@4c74356b41 - how would you capture the dynamic deployment username in the ARM Template without prompting for it as a parameter? I'd like to capture this for Resource Tagging purposes. – AndyHerb May 16 '19 at 15:25