Why the remaining credit amount is reducing although I'm not using the VMs? - azure

I've "Visual Studio Enterprise" azure subscription. I initially got few credits. I think it was $200 for free. Earlier it used to show static remaining credit i.e. if I built two VMs and it cost $50 it would show $150. But since few days may be just past day remaining credit is continuously reducing.
The activities I have done so far. Earlier I was unable to connect to VM as outgoing connection was not allowed from my organisation. Since I have got permission I'm able to connect. After that I installed Active Directory Services on one of the VM.
I don't think till this step my credit amount got reduced except for the VMs I built.
I was trying to start and stop the VM using powershell but I wasn't able to do so. So I installed powershell azure modules. using Connect-AzAccount to connect and then used Start-AzVM and Stop-AzVm to start and stop the VMs. Just to clarify I keep the VMs in shut down mode so I don't keep getting billed.
Still the amount is being deducted. I ran Disconnect-AzAccount on suspicion that it might be causing the issue but still it hasn't fixed the issue.
Can any one help here?

There are mainly two ways to stop VM:
Stop the Azure VM locally: When you connect to the Azure VM with remote desktop, go to the Power options within Windows and select Shutdown, this will essentially “turn off” the VM and stop it from running. However, even though the VM won’t be running you WILL still be paying for the Virtual machine hardware allocation. Doing this will cause the Azure Portal to report the status of the VM to be “Stopped”.
Another way is to click Stop in the virtual machine page on the portal(or use Azure PowerShell or Azure CLI). Instead of just shutting down the Operating System, Azure will also deallocate the hardware (CPU and Memory) allocation. Doing this will cause the Azure Portal to report the status of the VM to be “Stopped (Deallocated)”.
Overall, both methods will reduce cost but not none of cost. You do still pay for the Azure Storage account usage, which is used for storig the VM’s .vhd disk image file. As a result, you will still incur some cost for the storage, but at least you will save on the VM resources.
Ref: Properly Shutdown Azure VM to Save Money

You need to identify what resource are been billed when VM is stopped or Stopped De-allocated.
Check the Cost analysis under Cost Management to identify the resource. Note that when VM is stopped you still pay for storage and other resources depending in your setup.

Related

VM is still incurring compute charges, even though it is "stopped"?

I have a VM running Windows on Azure... I do not currently need it running, so I used the Portal and "stopped" it a few months ago.
However, I am still incurring compute charges. And when I visit the Portal, it says the VM is still incurring charges and that I need to "... use the Portal to stop it ...".
But at the same time, the Portal is showing that the VM is already "stopped". I have included a screenshot. Why does it incur compute charges when it is supposedly already "stopped"?
This is an Azure "feature". You have to deallocate the VM for it to stop costing you money. The screenshot even says that. To address your second question, if its not incurring charges it would be in deallocated state.
If you are using automation, you need to issue the deallocate rest call
https://management.azure.com/subscriptions/xxx/resouceGroups/yyy/Microsoft.Compute/virtualMachines/vmName/deallocate?api-version=xxx

Best practices for reducing Azure VM hours?

I recently implemented SSRS on a Azure VM and was very surprised when I realized I would be billed for 100% of the hours in a month if my VM was running. This runs around $200 and is in no way economical for our small reporting service we use for about 5 days month. What are my options for reducing VM hours?
I have already established I can shutdown and deallocated the machine when we are not using it. Ideally though the service would go into some kind of sleep mode and reallocate when the service is pinged.
You pretty much figured it out: When a VM is running, you're billed for it. This is how it's always been in Azure: Whether utilizing 0% or 100% of the VM, you're billed for the running VM. Think of it as paying for reserved resources. Just like an apartment, where you pay for the rent even if you're using it 0% (e.g. not home).
You can choose to stop the VM at any time, and billing stops, until you start the VM again. This is easily done via PowerShell / CLI, so you can automate it with your own tooling.
Note that VM billing is actually per minute, so if you shut down a VM after 30 minutes, you're not billed for an entire hour.
Only you can decide the proper way to manage your VM's uptime, based on your app's usage. There's no single right answer to that. And there's no mechanism for the VM to sleep if it detects inactivity. That's going to be an application-dependent thing (deciding when to shut down).
You have a couple of options to correct address this:
You could use automation, where you run a Powershell script to turn you VM off during off-peak time. Check this out:http://azure.microsoft.com/blog/2014/08/20/azure-automation-capabilities-in-depth-the-azure-automation-powershell-cmdlets/
You can setup alerts now in your account portal (yeah, I just said that!) Check it out here: http://azure.microsoft.com/en-us/documentation/articles/azure-billing-set-up-alerts/
I would look at both. You can shut-down a VM from PowerShell (MS just demonstrated that to me in a workshop this week), so I would use this approach if you know that SSRS is only going to run for a specified window.
You can also check Azure automation option if you have a definite schedule for the VM to be up and down. Azure automation gives you a way to create a runbook to manage the up time of the VM and also options to do the scheduling. Check this blog for more information https://blogs.endjin.com/2015/01/using-azure-automation-to-run-vms-during-office-hours-only/

Cloud Services vs VM deployment Cost

We are working on architecture of new web application to be hosted on Azure. This application would run only in day time (Say 9AM to 5PM). What I read so far about Azure is we would continue be billed even when we stop the deployment.
However in case of Azure VM (IAAS) billing stops when we stop the VM.
Client is keenly interested in running the IT cost to the minimum. We are planning to use WASABi/Auto-scaling block to auto shutdown & auto-start the app to run only during (9AM-5PM)
Deploying application every morning & deleting every evening even programmatically doesn't sound like a good architecture.
Should we target the app for VM rather than Azure web role?
While hourly billing cost is definitely a consideration and it is true that if you stop a VM in IaaS, billing stops, there are other considerations as well. Some of them are:
With Cloud Services, you have to architect the application in a certain way to take advantage of statelessness there. So there may be a bit of a learning curve there. With Virtual Machines, in theory you can build an application the way you are used to and deploy that in the cloud.
With Cloud Services, the major advantage is that you don't have to maintain the VM. This is something Microsoft does that for you. So there's little or no IT-admin overhead. With VMs, maintaining the VM is your responsibility so that's an additional cost which is recurring as well (assuming you (or your client) have an IT Admin kind of guy on the payroll).
Generally speaking, if the application is a stand-alone application with quite simple deployment topology and is brand new application it is recommended that you write them as Cloud Service but do take the costs (development / IT admin) into consideration as well.
When you stop the virtual machine through a standard shutdown (through the machine itself for example), it does continue to incur charges. The portal will eventually show it as shutdown, but the VM still has resources allocated.
However, if you stop the machine through the portal, API, or PowerShell, it will stop and DEALLOCATE the machine. This means the VM will use storage space, but will not incur compute charges.
Simply schedule the deallocation of the machines during off-hours, and you will only page for the usage during the day.

Azure Virtual machine is stuck at "starting"

I'm testing Azure using my MSDN account.
All went well, until I went over my spending limit, after which my services were suspended.
After my account was re-enabled, I wanted to start my Virtual Machines again.
However they keep having status 'Starting'.
The user-interface of the Azure management portal seems to offer no methods to remedy this situation.
Any ideas on how to reset these servers, or find a way to determine what is keeping them from finishing the starting process?
do not delete it, you can use azure powershell to stop it and start it again. the keep disks lost one of vhd's when we tried to do it that way.
I am experiencing the same issues and don't know the cause, but you temporarily fix it by deleting the Virtual Machine - you will get the option to delete or keep the associated disks - KEEP THEM.
After about 10-15 minutes, the disks will appear in the My Disks part of the Create Virtual Machine gallery - allowing you to re-create the machine with the same disks. You can also reuse the same name etc.

90 days test Iaas Azure offer: how are calculated the costs when a VM is stopped

I have been doing some test and realized that when I stop a VM, I get a red warning saying that it still generates charges.
But on which basis ?
Furthermore, on some VM I created, the system without any reason starts fooling and reach a 98% CPU during several hours with no way to stop it or to connect with RDP. VM was totally dead and it's only after several hours that the stop command from the control panel succeeded.
Hope I will not been charged for this ? Who is able to decide if my VM is OK or fooling like a crazy horse ?
Moreover, is there any software allowing to transfer my VMs from Azure to my local system, and delete them on Azure to stop any charge ? for a simple backup with possibility to restore/restart them later ? Or to run them in my own hyper-V ?
Best regards
CS
Even if your VM is stopped, you still have resources that have been reserved for your VM (think of storage space, memory, CPU, ...) and these can't be 'sold' to anyone else. Deleting the VM will free these resoures and you'll no longer be charged.
Remember that Virtual Machines are still in preview, meaning things can go bad sometimes. And yes you'll be charged for this, but during the preview you get a 33% discount (more info here: https://www.windowsazure.com/en-us/pricing/details/).
The persistent disks of your VMs are stored in a storage account as page blobs. Using tools like Azure Storage Explorer, CloudXplorer, CloudBerry, ... you can download these VHD files and simply mount them in Hyper-V (You'll need to remember that you'll need a license if you want to run the machine on-premises).
Note that, if you simply delete the VM the disks won't be deleted (they will stay in your storage account). In that case you only pay for storage (which is very cheap).
The price of VM depends on their size and nature (prenium or not).
Also you have to pay for the storage, but a 120GB disks is not billed fully, only effectively used space is.
You can use IaaS Managament Studio to easily calculate how much your blob disk cost, and see links to pricing pages of azure.

Resources