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:
Related
For one of the test AKS clusters I am trying to update, it gives the following error.
Error: SkuNotAvailable.
Message: The requested VM size for resource "Following SKUs have failed for capacity restrictions:
Standard_D4s_v4' is currently not available in location 'SouthAfricaNorth'. Please try another size or deploy to a different location or different size.
I have checked and found that the quota is available in the subscription for this SKU and region selected.
Now cluster and pools went in to failed status
As far as I know, this error "SkuNotAvailable" is either a capacity issue in the region or that your SUBSCRIPTION doesn't have access to that specific size
You could once verify that by running the below Azure cli command
az vm list-skus --location centralus --size Standard_D --all --output table
If a SKU isn't available for your subscription in a location or zone that meets your business needs, submit a SKU request to Azure Support.
If the subscription doesn't have access, please reach out to azure subscription and quota mgmt support team through as support case to check and make sure it's available to use the particular size on your subscription in case they cannot enable that for any reason, there will be an appropriate explanation.
At this point there is nothing can be done at the AKS side.
I'm new to azure & trying to deploying a Spot Virtual Machine with windows server 2019 gen2. When I try to create virtual machine I got this error
"The template deployment failed with error: 'The resource with id: '/subscriptions/6b3845e9-2c4e-44c6-baaf-5efb515334c2/resourceGroups/cloud-vcenter/providers/Microsoft.Compute/virtualMachines/EXsi' failed validation with message: 'The requested size for resource '/subscriptions/6b3845e9-2c4e-44c6-baaf-5efb515334c2/resourceGroups/cloud-vcenter/providers/Microsoft.Compute/virtualMachines/EXsi' is currently not available in location 'eastus' zones '' for subscription '6b3845e9-2c4e-44c6-baaf-5efb515334c2'. Please try another size or deploy to a different location or zones. See https://aka.ms/azureskunotavailable for details.'.'. (Code: InvalidTemplateDeployment)"
How can I solve this error? My account belong to "Azure for Students" subscription.
"The template deployment failed with error: 'The resource with id: '/subscriptions/6b3845e9-2c4e-44c6-baaf-5efb515334c2/resourceGroups/cloud vcenter/providers/Microsoft.Compute/virtualMachines/EXsi'
failed validation with message: 'The requested size for resource '/subscriptions/6b3845e9-2c4e-44c6-baaf-5efb515334c2/resourceGroups/cloudvcenter/providers/Microsoft.Compute/virtualMachines/EXsi' is currently not available in location 'eastus' zones '' for subscription '6b3845e9-2c4e-44c6-baaf-5efb515334c2'. Please try another size or deploy to a different location or zones. Seehttps://aka.ms/azureskunotavailable for details.'.'. (Code: InvalidTemplateDeployment)"
This error causes due to
The VM size isn't available for a location or zone.
SKUNotAvailable-There is not enough Azure Spot Virtual Machine capacity in this location to create your VM or scale set instance.
If SKU is not available send an SKU request to Azure Support if an SKU is not offered for your subscription in a region or zone .
You check the available resources in selected region by using command Get-AzureRmComputeResourceSku then proceed to launch VM.
Get-AzureRmComputeResourceSku | where {$_.Locations -icontains "eastus"}
Output:
If the got actually available for your subscription\location combination you should use:
Get-AzVMSize -Location %location%
Output:
They also has some limitations in VM sizes are not supported for Azure Spot Virtual Machines
Reference:
Error codes for Azure Spot Virtual Machines and scale sets instances - Azure Virtual Machines | Microsoft Docs
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
I'm trying to setup Azure CLI. The first step is to create a storage for account files. I'm using my Developer Program Benefit subscription.
After I click "Create storage" I get an error:
Storage creation failed
Error:409
{"error":{"code":"MissingSubscriptionRegistration","message":"The subscription is not registered to use namespace 'Microsoft.Storage'. See https://aka.ms/rps-not-found for how to register subscriptions."}}
Can't create a storage account. Please try again.
How to resolve this issue?
The reason you're getting this error is because Microsoft.Storage resource provider which manages Storage Account related resources and activities is not registered with your Azure Subscription.
To fix this, please run the following command:
azure provider register --namespace "Microsoft.Storage" --subscription "<your subscription name or id>"
To get the subscription name/id, please run the following command:
azure account list
For more details on why you're getting this error, please see this: The subscription is not registered to use namespace 'Microsoft.DataFactory error
If you prefer GUI, then you can do it on the Azure portal too:
On the left pane click More services and then select Subscriptions
Select the subscription, in our case Developer Program Benefit
In the Settings area click Resource providers
Find Microsoft.Storage and click Register
This same error with detailed solutions are provided in this post:
How to fix Azure Cloud Shell error "MissingSubscriptionRegistration - The subscription is not registered to use namespace 'Microsoft.Storage'"
I am trying to create a template deployment using Azure Resource Management library for .net from a custom VM image. The goal can be achieved by creating a resource group and deploy needed resources (using the template file) using the aforementioned library. There is a requirement that upon deleting the resource group i also need to delete the Vhd that is created upon VM creation in the resource group. but if i delete the resource group, vhd file is not deleted because it is created in different resource group (hence different storage account, where the vm image exists) and there is a fact that custom vm image need to be present at creation time in the very same storage account that will host your virtual machine's vhd. i cant delete the storage account containing the custom image. So, is there a way that i can copy the custom image (vhd) from a storage account to my newly created resource group's storage account using Resource Management library for .Net?
or are there any other workarounds to delete the vhd of created vm without deleting the custom vm image??
Use
Microsoft Azure Storage Explorer
Copy/Paste the VHD from
Storage Account A\Blob Containers\uploads
to
Storage Account B\Blob Containers\uploads
There isn't any way to copy a blob during a template deployment, currently the storage resource provide doesn't support data plane operation during template deployments. You could break it into multiple deployments, for example:
Deploy storage account for new VM into new resource group
Run code to copy custom image for VHD to new storage account in the new resource group
Deploy VM to new resource group
But - if you're doing this through code, likely the simplest approach is to grab the URI of the OS's VHD before you delete the Resource Group that holds the VM. Then after you delete that RG, delete that blob. This PowerShell code will give you the uri of the vhd blob for a VM (.net SDK will be similar).
(Get-AzureRmVm -ResourceGroupName [name of RG]).StorageProfile.OsDisk.Vhd.Uri
If you have more than one VM in the RG, then you'll get an array and you can iterate through it.
Another possible workaround is to download the vhd file from the storage account to your local file system, delete the container or storage account, which ever you want. Then push this vhd file on the local system to the azure storage account you newly created using,
Add-azureRmVhd -Destination 'newstorageaccounturi' -LocalFilePath 'C:\users....\' -NumberOfUploaderThreads 5
Although, I do not understand why you want to delete the vhd of this created vm? Do you want to attach a different disk to it?