How to delete VM that doesn't exist in Azure - azure

A VM running in my Azure subscription was deleted and no longer shows up in the portal. However the NIC and disk are still attached to it, and until I'd disassociated the public IP I could still access the site it was publishing. I want to delete everything in the resource group, but cannot due to this issue.
Get-AzVM returns 'ResourceNotFound', although Get-AzNetworkInterface still shows the ID of the problematic VM. The NIC and disk still reference the missing VM but clicking on that doesn't load anything. Remove-AzVM doesn't have any effect. Attempts to delete the NIC or disk fail because of their attachment to the VM that shouldn't exist.
Has anyone had this issue? Is there a way to get Azure support involved without having a support plan?

Related

Can’t find storage account details for my Azure VMs

I have a couple of storage accounts in my Azure subscription. I know my VMs are using them because when I look at the Boot diagnostics blade for those VMs in the portal, I can see a diagnostic screenshot and a serial log (apparently the storage account is where this information is held). However, I’ve looked high and low and can’t find the setting that specifies which storage account is being used by which VM.
I also tried the Powershell script mentioned in
Powershell to List Azure VMs with storage account name. However, any field in the output that relates to a storage account is empty.
Can someone please point me in the right direction?
Thanks
If you mean the storage account for the VM diagnostic, then you can get the storage account URL with the command Get-AzVM like this:
$vm = Get-AzVM -Name vmName
$vm.DiagnosticsProfile.BootDiagnostics
Here it shows you the URL of the storage account that stored the VM diagnostic logs, but this is the only thing you can find in the VM. If you want to get more details about the storage account, just run the command Get-AzStorageAccount.
I actually want to know which storage account the VMs are using.
I ran the Powershell that you suggested both at my workstation and in the Azure shell console. However, even though the Enabled property returned True, nothing was returned for the StorageUri property (hopefully the image that I pasted into this reply will show this).
As per the pasted image, I also ran an Az command that did return a couple of URIs (one for the boot image and one for the serial log).
However, I don't believe that this information will lead me to discover which storage account is being used. Any other suggestion you can offer will be appreciated.
enter image description here

Azure VM backup/automation not working after restore

After the VM was restored (whole VM not disk), the backup stopped working in Recovery Service Vault. Also the Azure automation account that used to shutdown the VM, stopped working. How to fix it such that all restored VMs continues to work as the previous one?
Kindly note that if you restored a VM to the same resource group with the same name as the originally backed-up VM, backup continues on the VM after restore, else if you restored the VM to a different resource group or you specified a different name for the restored VM, you need to set up backup for the restored VM.

How to check if backup is enabled on azure virtual machine using azure command or virtual machine level flag

How to check if a backup is enabled on an azure virtual machine using PowerShell or azure command
in my use case, I don't want to go with Get-AzureRmRecoveryServicesBackupContainer stuff, looking for any other option available on the virtual machine level for checking backup status of a VM.
Thanks
There is pretty much nothing on the az vm cli for what you are looking for.
To check directly on the vm level, you need https://learn.microsoft.com/en-us/powershell/module/az.recoveryservices/Get-AzRecoveryServicesBackupStatus?view=azps-3.0.0
Thus you will get the BackedUp property to check if your vm is being backed up.
In type parameter, you need to use AzureVM value. Name and resource group I need not explain.

Can we recover the azure resource group in azure cloud?

Some times we had deleted the 'resource group' accidentally on azure cloud, its fine that if our/your resource group does not have any deployments on it and we can create immediately newer one and will proceed our stuff, but if we had deployments on it, then its becomes major problem/task.
So can we recover Resource Group? like a recovery of Virtual machine in Azure.
You can export service configurations that belong to a resource group as JSON. Within the portal, there is an option "Export Template" under the Resource Management Navigation Group.
So can we recover Resource Group? like a recovery of Virtual machine in Azure.
Unfortunately, we have no way to recovery it, if the resource group is deleted . We could get the warning if we try to delete resource group from the azure portal. Connect to Azure support team for help maybe a way, but I don't think it could be easy for restoring.
Note : based on my understanding even if we could re-create the resource with ARM template(If we have exported the ARM template before delete), it seems that just with the same resource names with deleted resource that is not equal recovery action.

My azure Virtual machine is in failed status

My Azure virtual machine is in failed status and its not allowing me to do stop and start. I am getting error message
" Provisioning failed. Could not resolve storage account testrgdiag502. Please ensure it was created through the Storage Resource Provider in the same location as the compute resource.. StorageAccountLocationMismatch "
According to the error code, we should check the location of your storage account. This error occurs when the location of the VM disk and the computing resource is different.
More information about this error code, please refer to this link.
To resolve this issue, we can re-create a new storage account and the location same as Azure VM.
Another way, we can create a new VM with this VM's VHD.
Here is a template, we can use this template to create a new VM with an existing VHD.
=================================
Update:
If your subscription can't create any Azure VM, please new a support request(free), please follow this screenshot:

Resources