A cool way to save costs on Azure (convenience for a sandbox) before the big sentence aka DELETING 😱 resource(s).
The example will focus on Synapse Pool and Stream analytics job. However the script could be used as a template and be leveraged to suit different use cases.
In the case above, Synapse pools are the resources costing the most in the subscription (https://azure.microsoft.com/en-us/services/cost-management/#overview)
Step 2 Understand how any resource(s) identified in step 1 is/are priced and how you could modify the resource(s) to make the cost cheaper
- Have a look at the Azure Price Calculator 💰
- Have a look at the Azure Powershell documentation 📖. Look at the Reference part especially to list what options are available for your resources (Pause, Stop, Reduce the compute, etc)
Step 3 Create a Powershell script that "minimizes" the costs based on the options identified in Step 2
In this case, Synapse Pools are the main "problem".
Let's minimize the cost for those resources.
The stream analytic job will be also modified.
What we will be doing for:
-
Synapse
- Suspend the pool with the command Suspend-AzSynapseSqlPool
-
Stream Analytic job
- Stop the job with the command Stop-AzStreamAnalyticsJob
The script will iterate through all the resources in the subscription.
Each Synapse Pool running will be paused.
Each Streamin Analytic job running will be stopped.
The following link will guide you to create and schedule a runbook: https://docs.microsoft.com/en-us/azure/automation/learn/automation-tutorial-runbook-textual-powershell When creating the job, make sure you add any module required (see the example provided)
The final step is to decide the frequency of the job. For example, run the runbook everyday at 10pm.
After running the script in a runbook, you can verify what has been modified: