Do my azure account permissions affect my Virtual Machine operation - azure

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

Related

Start azure virtual machine without azure portal

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.

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.

Azure shut down schedule

We have a client who runs Dynamics NAV infrastructure on Azure VM. I am about to configure a schedule in such a way,it matches office hours.
What will happen if service is used at shutdown time and other user interacting with the service running on VM. Is there a way to manage that?
Thank you.
I am about to configure a schedule in such a way,it matches office
hours.
You could use Azure runbook to schedule start or stop your VM, please refer to this blog.
What will happen if service is used at shutdown time and other user
interacting with the service running on VM.
If your VM shutdown, Dynamics NAV could not provide service. If your user need Dynamics NAS service, you need start your VM.

Azure vm stopped unexpectedly, says "Storage account xxxxxxxx not found,...."

My Azure VM with Windows server 2016 stopped unexpectedly today. When I tried RDP today in my vm, it was saying 'machine unavailable'. So I logged in to Azure portal, and the VM was actually running. But when I tried to restart it, I got a notification saying
"Failed to restart virtual machine xxxxx. Error: Storage account xxxxxxxx not found. Ensure storage account is not deleted and belongs to the same location as the VM."
But, I was successfully using the vm till today. I didn't do anything in the Azure portal. The storage account with the vhd still exists (in the same resource group). I once deleted an unused storage account about 2 months ago, but the VM was running perfectly till today. I am not sure about anything that may have happened. The activity logs are empty.
Please Create a new storage account with the name – 'xxxxxxxx' in the same region as VM and then restart the VM to mitigate the failed error.
Why?
It is looking for already deleted storage account. This happens mostly for diagnostics storage accounts (I can't exactly say whether this is a diagnostics one without knowing the account name. diagnostics account names are something like xxxxxxdiag). Sometimes, disappearance of diagnostic account doesn’t cause the VM to be unreachable but the VM would just be marked as ‘failed’ over the portal.
If the virtual machine stopped unexpectedly and is not available again, we can report the issue to the Azure support team from the Azure portal. Please have a try to confirm with the Azure support team whether it can be recovered.
According to your description that the VHD file is existing in the storage. We also can recovery the machine from the VHD file. More detail steps please refer to another SO thread.
This issue may be because the diagnostics storage account for the VM is deleted. You can solve this issue by Redeploy your VM under Support + Troubleshooting tab in the VM blade. See image:

Scheduling startup (booting) of a Azure VM

I have a Windows based VM on Azure Cloud. Using the Portal on portal.azure.com I can start/stop the machine.
Is there a way to create a schedule in Azure so that the VM is started (booting) on a specific date/time / schedule? So that the VM's state is changed from Stopped (deallocated) to Running when it is scheduled to do so?
You can schedule any operations with Azure Automation.
This article describes how to run Azure VMs during office hours.

Resources