0
votes

I want to give access to somebody to a virtual machine on Azure (with the RDP connection file) and let him start/stop the VM but without giving him access to the Azure Portal account.

Is there a (simple) way to start/stop virtual machine on Azure without having to access the portal ? By "simple" I mean something that you don't need to run some line code and that can be as easy as opening a RDP file.

Alternatively, is there a way not to be billed of a running (but idle) virtual machine ?

3
The easy way is to script this part ... also you can grant granular permissions to the user with a custom role so he will only see the vm while connecting to the azure portal. - Thomas
Any more questions? Does it solve your problem? - Charles Xu
yes it does thanks - MMR67

3 Answers

0
votes

For your requirement, I think the best way is to use the Service principal with the role of Virtual Machine Contributor. It just lets the user manage the VM, but without access to the VM and also do not have the permission to access the Azure portal.

Then you can use this service principal to execute the Azure CLI, Azure PowerShell commands or the REST API to start/stop the Azure VM, it does not cost.

2
votes

You can use a Powershell script to start/stop the VM.

No you will be billed for the stopped VMs also as long as you have checked them out.

0
votes

Is there a (simple) way to start/stop virtual machine on Azure without having to access the portal ? By "simple" I mean something that you don't need to run some line code and that can be as easy as opening a RDP file.

There are SDK's available which you can use along with CLI to have programmatic access to the VM - in this manner, you do not require access to the portal.

Alternatively, is there a way not to be billed of running (but idle) virtual machine?

You will be billed for idle VM as this still means that VM is operational. To save costs, terminate the VM and create the VM again when required.