Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, April 24, 2019 7:55 PM
I am creating VMs from the C # SDK, using an image as a base. In this image I had defined a task in the Task Scheduler, its function is as soon as the machine is turned on, run a pre-defined executable. The problem is that it is not running the task, I believe it is because of the user linked to it, that it was a user of the other machine on which the image was generated.
Does anyone know how to escape this problem or create some user who has access to all the Vm's created in my resources?
Print of: https://prnt.sc/ngboao
All replies (14)
Wednesday, April 24, 2019 8:12 PM
Hi,
The only way you would be able to use a single user for this task that has access to all servers is to use a domain user. But for this, all VMs would need to be on a domain. Then permissions for that user would depend on what the task is trying to achieve.
Or you can set a local system user on each machine that needs the task, rather than one user to run them all?
Thanks,
Matt
Wednesday, April 24, 2019 8:51 PM
Hi Matt, Thanks for your reply.
I don't know what's the best or easy way to do this, the only thing i need it to run this task after create the VM using the image, if there's a way to create or select an user in the definition of the Task Scheduler would be great, so i can create the image with the right options.
Do you know how can i procede with the solutions that you give?
Wednesday, April 24, 2019 8:54 PM
What does the task actually do...like does it need any special permissions? You could use a local system account for the task to run, depending on whether the permissions for this are correct?
Wednesday, April 24, 2019 9:08 PM
The task only runs an app at startup of the machine. In the former machine it's working really well, it's running the app with no problem, but if i make another machine using an image of this former machine the app will not run.
When i log into the VM and try to edit the task it's sending back to me an error, because the user don't exist in this domain, i suppose.
Wednesday, April 24, 2019 9:18 PM
Scheduled tasks are built on XML definitions. So if you're wanting to change it for just this server, you have the option to right click and export the XML, which you can then edit and import again.
But if you're using this image for multiple servers then you'll want to have a local account set for the task on the original server and then take a new image.
Wednesday, April 24, 2019 9:42 PM
Yes, i create these VM's at runtime, i don't know if it's possible to edit the task by C# at the creation proccess.
How can i find this local account information?
Tuesday, April 30, 2019 6:18 PM
Hi,
Apologies for missing this. If the VM image already has the task there with the incorrect user then a new image will need to be taken with a local user being used. Which user depends on the task that the job runs though?
Thanks,
Matt
Friday, May 3, 2019 7:00 PM
Any update on this issue?
Monday, May 13, 2019 3:23 PM
Without any progress in the task, I have not found any option in Azure that allows to create an user and that user can be used in the Task Scheduler in a way that is not linked only to the domain of that machine.
Monday, May 13, 2019 3:43 PM
Hi,
If you use a local system account though then it wont need to be unique per VM. Can you run it as local system?
Thanks,
Matt
Monday, May 13, 2019 7:58 PM
I don't know how to do this, the task is created with an user inside the VM folder.
Monday, May 13, 2019 8:12 PM
Hi,
And you said earlier you cant change that user as it gives you an error? Can you recreate the scheduled task manually using that as a template?
If not, what you can do is:
- export the task by right clicking it and save it to the desktop.
- edit the XML file from the exported task and manually change the user in the XML file to one that exists on the server.
- Also change the name of the task from this XML file
- import the edited XML and you should then be able to edit it.
Once you can edit it, try setting it to run as a local user such as NT AUTHORITY\SYSTEM - this will exist on all servers and so should work for you :-)
Thanks,
Matt
Tuesday, May 14, 2019 2:01 AM
I can change the user, i just don't have an user that is on a parent directory, that is used for any machine, there's a way to do this on Azure Portal? This seems to the the best way to achieve what i want.
Tuesday, May 14, 2019 6:32 PM
HI,
You dont need a user on the parent directory for this. As the machines wont have local users that you can use, for a generic task you can use a local system account on the VM.
Hope that makes sense?
Thanks,
Matt