Azure Basic Small App cost - azure

I've had to switch from the Shared tier to Basic, to avail of SSL support and with that I knew there would be a price hike. But for me it has gone up exponentially - this is going to cost me an extra £50+/month.
I have turned off the "Always On" setting and from analytics I can see that there is no traffic between 11pm and 5am most nights yet im averaging a bill of 22 hours per night service for the last 23 days...that's effectively "Always On".
Anyone know if I need to tweak something else to reduce the costs? Is there a setting that determines how long before the service goes to sleep?

The cost that you pay for the instances in App Service runs all the time, traffic does not matter.
If you have 1 instance in the plan, you pay for that 1 instance all the time. Always On just prevents an app from idling. It won't reduce billing if you turn it off.
At minimum on Basic tier and up you pay for 1 instance + outbound data traffic.

As juunas stated that Always On could not help you to save the cost, it just be put to sleep and free up resources for other web apps on the same service plan.
Anyone know if I need to tweak something else to reduce the costs? Is there a setting that determines how long before the service goes to sleep?
Even if you stop your app, the App Service plan charges still apply, and the service plan could not be stopped. For a workaround, you could schedule a task and invoke Azure Management SDK to switch the App Service Plan (Shared, Basic).
Use Microsoft.WindowsAzure.Management.WebSites with the authentication using a management certificate. Here is the core code, you could refer to it:
Change pricing tier from Basic to Shared
using (WebSiteManagementClient webappClient = new WebSiteManagementClient(credential))
{
//you could leverage webappClient.WebSpaces.List() to retrieve your webspace
//the format of your web space would be: "{resource-group-name}-{location-of-your-appserviceplan}webspace"
var webSpace="{your-web-space}";
webappClient.WebHostingPlans.Update(
webSpace,
"{The name of the web hosting plan}",
new Microsoft.WindowsAzure.Management.WebSites.Models.WebHostingPlanUpdateParameters()
{
NumberOfWorkers = 1,
SKU = Microsoft.WindowsAzure.Management.WebSites.Models.SkuOptions.Shared
});
}
Note: After change the pricing tier to Shared, your configured SSL certificates would be reserved and until you change it back to Basic, you could retrieve and modify it and it could take effort. Moreover, if you scale out your app into multiple instances, you need to specify the property NumberOfWorkers when you changing pricing tier to Basic. For more detailed steps, you could refer to this similar issue.

Related

How can I schedule an Azure app service to only be running (being billed for) working hours

On Azure's payment estimator, I can choose the number of hours that I want an app service to be active/paid for. As my app isn't required out of office hours or at weekends, I could reduce the number of hours and therefore the cost estimate considerably versus paying 24/7. I therefore used the estimator to come up with an (affordable for my organisation) estimate of having the services running for max of 500 hours a month.
What is not clear is how, now I have app services up and running on Azure, do I set the services to run on a schedule that matches the cost estimator? Is there an option or functionality hidden away somewhere to do this?
There is no option to suspend an azure app service plan. You can stop/start a web app running on a plan but that won't save any costs. I agree it is confusing that the pricing calculator makes it seem that you can suspend a web app plan.
The only thing I can think of is to scale down to a free tier plan during out-of-office/weekend hours and scale up to a paid plan but that is limited to some basic tiers (for example, since there are no slots in some lower tiers you will have problem if you want to use those). You will have to script this yourself.
The other option is to delete the whole app service plan and web app and create it / deploy again when needed. You can automate the creation using a bicep or ARM template.
References
https://learn.microsoft.com/en-us/answers/questions/278494/can-we-stop-azure-app-service-to-save-cost
Automate tier scaling
App Service unlike Azure VMs don't have the ability to pause billing. If the App Service exists, it is billing. Please see the below recommendations to control costs.
Optimize costs
At a basic level, App Service apps are charged by the App Service plan that hosts them. The costs associated with your App Service deployment depend on a few main factors:
Pricing tier Otherwise known as the SKU of the App Service plan. Higher tiers provide more CPU cores, memory, storage, or features, or combinations of them.
Instance count dedicated tiers (Basic and above) can be scaled out, and each scaled out instance accrues costs.
Stamp fee In the Isolated tier, a flat fee is accrued on your App Service environment, regardless of how many apps or worker instances are hosted.
An App Service plan can host more than one app. Depending on your deployment, you could save costs hosting more apps on one App Service plans (i.e. hosting your apps on fewer App Service plans).
Source: https://learn.microsoft.com/en-us/azure/app-service/overview-manage-costs

Azure App Service Plan - Pricing Model Questions

While doing some research for a customer some doubts have rise regarding how the pricing on App Service plans work and what would be the best way to configure the ARM templates for different projects.
What I would like to confirm (and I don't think that Azure documentation is very clear on that) is if you pay only for the App Service Plan itself, even if you don't have any web apps running.
Imagining that I would like to have 2 web apps running on a Standard tier, is there any difference of having a different app service plan for each that I can later change independently for a single project? (e.g. one of the web apps may require more compute power in the future while the other doesn't).
And if by any change we remove the web apps from the subscription but still leave there the App Service Plan configuration... is anything paid in that case, even if there is no computing happening?
Thanks for the help everyone. Cheers
TL;DR You pay for an App Service Plan, not for an App Service.
Looking at App Service Plans details, you see the number of Apps an App Service Plan can have.
A Free plan can have 10
A Shared plan can have 100
A Consumption plan for Functions can have 500
All other plans can have unlimited
Now for your question: you don't pay per App Service. You pay per App Service Plan. And this is regardless the number of apps. This is because you pay for the fact the plan is there, ready and waiting. You've reserved the resources specified in the tier you selected. The fact you're not using them isn't of influence.
Of course, consumption plan is the odd one out, since there you do pay only for compute used.
If you take a look at Pricing - App Service, you also see the pricing tables specify pricing for App Service Plans, not the App Services.
EDIT:
I would pay more for 2 service plans with 1 app each than 1 service plan with 2 apps on top
Yes.
Since an App Service Plan is an abstraction for (something like) a virtual machine, having 2 App Service Plans means having 2 virtual machines that are reserved for you.
EDIT2:
As #Juunas said in his comment:
you do pay per VM in your plan, so if you set scale out to 3 instances, you have 3 VMs running your app, so pay 3 times more than with scale out set to 1.
So 1 plan with 1 instance and 2 apps is cheaper than 2 plans with 1 instance and 1 app per plan. But if the 1 plan has 2 instances and 2 apps, you pay the same as in the 2-plans-1-instance scenario.
This is starting to get complex ... 🤔

Accessing a mailbox with the new Graph API how to estimate cost?

I have a need to read a dedicated mailbox and read new messages and its attachment. The preferred way to do this now, seems to be with the newer Graph API. This requires setting up an azure application. Ok, so forgive the newbie question, but how can I get an idea of what an expected monthly cost will be?
Taking for granted that you already have an Office 365 (Exchange Online) subscription and Azure AD tenant, neither AAD application registration nor Graph API requests wouldn't cost you anything extra.
As for the application itself, the cost will depend on the Azure service you'll choose it to deploy to. You've used the "azure-functions" tag in your question, so I assume that's what you are going to use. Well, it's quite hard to estimate an Azure function cost before actually running it (do you know the resource consumption of a piece of software which doesn't exist yet?), so I'll suggest you proceed this way:
Create a new Function App, be sure to select "Consumption Plan" as its hosting plan;
Go to your app -> Function app settings and set the "Daily Usage Quota (GB-Sec)" as 12900. This way you'll ensure your app will not exceed the 400,000 GB-s execution time, included for free in your subscription;
Deploy your application and have fun with the Graph API for free;
Enable Application Insights integration for your function app and monitor Execution Count and Function Execution Units metrics to have an idea of what's your function approximate consumption is.
P.S.: Please have in mind that other Azure resources you would utilize besides your function itself (storage account, application insights, outbound traffic, etc.) could result in some charges, though I doubt they will exceed a couple of bucks monthly if you don't store terabytes of data as a part of your app logic.

How to turn on/off Azure web apps during office hours [duplicate]

I thought one of the advantages of Azure was that I could turn services on and off depending on when I want them to be available.
However I cant see how to pause my App Service Plan.
Is it possible?
I want to use the S1 tier so that I can play with what it offers. However I want to be able to pause the cost accumulation when I am not using it.
I see from the app service pricing help that an app will still be billed for even though it is in the stopped state.
Yet the link also clearly states that I only pay for what I use. So how does that work?
If you put your hosting plan onto the free tier, you will stop being charged for it. However if you have things like deployment slots and certificates these will be deleted.
The ability to turn services on and off, is more to do with being able to scale services, so if you need 50 servers for an hour you can easily do that.
What you can do to make your solution temporary is to create a deployment script, using Powershell or Resource manager Templates then you can deploy your solution for exactly as long as you need it and then delete it again when you don't. In this sense you can turn your services on and off at a whim.
Azure provides building blocks for you to create the solution you need, it is up to you to figure out how to best use those building blocks to create the solution you seek.
Edited to answer extended question.
If you want to use the S1 pricing plan, and not have it charge when you are not using it, the only way of achieving that is by using automation. Fortunately, this is reasonably trivial to achieve.
If you look at this template it is pretty much all configured to deploy a website from Github to Azure on demand. If you edit that to configure it to your needs you can have a new Azure website online with 2 minutes of running the script.
Then you would have another script that deleted it once you had finished.
Doing it this way you would loose no functionality, and probably learn quite a bit about what is possible with Azure along the way.
App Service Plan
An app service plan is the hardware that a web app runs on. In the free and shared tier your web apps share an instance with other web apps. In the other tiers you have a dedicated virtual machine. It is this virtual machine that you pay for. In that case it is irrelevant whether or not you have web apps running on your app service or not, you still have a virtual machine running and you will be charged for that.
To change the App Service Plan via PowerShell, you can run the following command
Set-AzureRmAppServicePlan -ResourceGroupName $rg -Name $AppServicePlan -Tier Free
I was able to accomplish this using the dashboard by selecting the App Service Plan, clicking Scale up (App Service Plan), and then from there if you click Dev/Test you can select the Free tier.
As others have mentioned, you need to script this. Fortunately, I created a repository with one-click deployment to your Azure resources.
https://github.com/jraps20/jrap-AzureVerticalScaling
The steps are intended to be as simple and generic as possible:
Execute the one-click deployment from the repo readme
Select the subscription, resource group etc.
Deploy resource to Azure
Set up your schedule to scale up and scale down as-needed
The scripting relies on runbooks and variables to maintain the previous state of each App Service Plan and App Services within those plans. Some App Services cannot be scaled due to specific settings being used (AlwaysOn, Use32BitWOrkerProcess, ClientCertEnabled, etc.). In those cases, the previous values are stored as variables prior to down scaling and then the original values are reapplied when the services are scaled up.
For more clarity, I have written a blog post that goes into detail. The post is pertaining to Sitecore, but applies to any App Service setup- Drastically Reduce Azure PaaS Hosting Costs in Non-Prod Environments With Scheduled Vertical Scaling. It also includes a brief video tutorial to show its use case.
Myself and others have been using this repository/approach for well over a year and it works great. I mostly use it for POC's to reduce costs when I'm not actively working on something. However, its main intention was for targeting non-prod environments to save costs during non-work hours.
Azure App Service Plan is just an logical concept of a set of features and capacity that you can share across multiple apps. I don`t think you can "pause" a plan, instead you can pause your service. and depends on billing model of each service, you might or might not get charged.
Pausing = Delete or lower tier.
Scripting is the key.
Design Diagram
Use scripts to create (also consider shared resources)
Delete using scripts
Use scripts to recreate.
eg: If we use resource group properly per environment then
Export-AzureRmResourceGroup will create a template for us (everything in the resource group will be pulled out as script). So we can delete it and recreate it anytime.
To pause a VM and stop billing you need to shut is down and deallocate it. Just shutting down still has the capacity reserved as if its running.
Storage can't be shutdown - it can be moved to lower cost tiers.

Minimize cost for Azure Cloud Service

I have an Azure Cloud Service published at Microsoft and it's draining all my credit!
Payment
Pay as you go
Service resource
Minimal resource, 1 SMALL web role and 1 SMALL worker role.
I knew Azure wasn't cheap, but this is just too much. Currently my monthly cost is just under 80 USD. The only person that use this service is me, noone else, and I barely use it. So the cost is just for the upkeep.
Is this normal?
70 bucks a month!?
How much does it cost for YOU?
What Microsoft support told me
I am afraid the Cloud Services has a fixed price, and I am not aware
how it could be lowered. Maybe you want to check on how the service
itself could be tweaked to get it working as per your needs. You may
want to go through the Community Forum for that.
Community = Stackoverflow, so here I am!
If I look at my Azure subscription page I can see that it's the:
CALCULATING HOURS - Europe, Western
That is taking all my hard earned money. My service also uses SQL, storage and cache but, if I understand it correctly, these are not the cause for my expensive bill.
Before I leave you to it I just want to say that I can't use a simple web app because of my requirements. I know web apps are super cheap, but in this case I must use a cloud service..
Thank you
Update
I found out I was using A1 (small) and not A0 (extra small). The instance type for a cloudservice can be set in the servicedefinition file.
It's sad that not even Microsoft themselves could inform me about this.
Web and worker roles are like dedicated VMs if they are on, they will cost you money.
You can do one of two things
1) Stop the machines when no one is using them ( say in the off business hours). I am not sure if this is possible to do or not in your case. But if it is possible, you can run a small script to start/ stop the roles. You can even do so via apps on your phone. For example - https://itunes.apple.com/us/app/azure-management/id826446897?mt=8
2) Move to Azure Web Apps and Azure Web Jobs - Both these services are "multi-tenant" and cost much less and in fact offer a free tier. If and when you need to scale, you can always scale as your need
Hope this helps

Resources