Start azure virtual machine without azure portal - azure

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 ?

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.

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.

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.

Related

Do my azure account permissions affect my Virtual Machine operation

I have a Virtual Machine in azure that is set to boot up daily, run some scripts via cron, and then shut down.
A week ago my colleague changed my took away my co-adminstrator role within Azure. Since then the scripts have failed to run. I don't even know if the VM has been booting up.
How does the role/permissions associated with my account affect the behaviour of a VM that I have created?
EDIT
I suspect the point of failure is the Automation Task that starts the VM each day.
How does the role/permissions associated with my account affect the
behaviour of a VM that I have created?
To run the automation tasks in a VM, the account which used to authenticate the VM should have the proper role/permissions.
As you are no longer the co-administrator of that Azure Subscription, you should have a proper role to run the automation tasks in a VM with your account.
For example, with the contributor role, you can create and run the automation tasks in your Azure VM

Can i view data on my Virtual machine from Azure portal?

I have a VM in Azure. Is there a way I can navigate the c: drive of the machine from within Azure portal and not rdp?
You could try to use Azure Bastion service:
https://learn.microsoft.com/en-us/azure/bastion/bastion-create-host-portal
Or Run Command:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command
There is no way to do this. If you are looking for a shortcut, instead of connecting to RDP, it is not possible.
You can use Azure File storage instead if you need similar functionality.

How to add user assigned managed identity to Azure Lab VM?

My goal is to have a VM to run builds for Azure DevOps with a user-assigned managed identity so we can keep everything connectionStringLess.
I have just created an Azure Lab and a VM in it.
The reason for this in the lab is so we can shut it down during nights and weekends.
However, I can't find the option to assign managed identities to it.
If possible, how do I do it?
Looks the lab VM (Microsoft.DevTestLab/labs/virtualmachines) does not support MSI currently, you need to use the azure VM(Microsoft.Compute/virtualMachines).
Reference - Services that support managed identities for Azure resources.
Besides, I notice you use the lab VM for auto-start/stop reason, actually the Azure VM also supports that, see Start/Stop VMs during off-hours solution in Azure Automation, not only schedule VMs to start and stop, but also other features.

How to determine if Azure VM is VM Role (preview) or Virtual Machines (GA)

The VM Role preview in Windows Azure ends on May 31, 2013 and Microsoft urges to migrate VM Roles to "proper" Virtual Machines that are in General Availability as described here:
http://msdn.microsoft.com/library/3dae01d2-2397-47ed-a134-f9ffe58a9b52.aspx
But how do I know which of the Virtual Machines running in Azure are VM Roles and which are Windows Azure Virtual Machines?
I wrote a blog post that may help: Do I have VM Roles that I should migrate? at http://blogs.msdn.com/b/benjguin/archive/2013/04/19/do-i-have-vm-roles-that-i-should-migrate.aspx
You probably see it easily in the portal, but an easy check could be to store something on your disk and stop/delete and recreate the machine. If the file is no longer there, that means it's a VM role.
I also believe you cannot see VMRole in the new portal (and only in the old portal)

Metrics related powershell commands in azure

We're trying to get the cpu percentage,disk read throughput,etc programmatically using powershell commands for metrics in azure but we are not able to get any of the commands according to new release.
First of all are you trying to get performance details from Web/Worker Role or New preview release of Windows Azure Virtual Machines?
With Windows Azure Virtual Machine:
You have full access to your Azure VM and configure it the way you would do in any remote VM and the get the performance data out of it. With Windows Azure Virtual Machine if you want to get Performance data from Powershell you would need to do the following:
Configure to Azure VM to have PowerShell Remote Access
Configure Azure VM port settings so you can connect from on-premise machine (this is must and you should know that open port will open connection to VM outside)
Configure Azure VM to collect performance data
Connect from your on-premise machine using PowerShell and collect performance data
You can find several resources on Internet to do above task.
With Web/Worker Role:
Even when you are using new Powershell cmdlets with Windows Azure, older commands are still accessible and working as expected. To get Performance metrics from Azure Here are some resources for your to try:
Windows Azure Diagnostics and PowerShell – Performance Counters:
Part 1 | Part 2
How To Easily Enable Windows Azure
Diagnostics Remotely

Resources