The PSWattTime module has been released! This module allows you to query the WattTime.org API to get the carbon emissions of a given Azure region. I use the module in infrastructure-as-code test deployments to ensure that we are not deploying to regions with high carbon emissions when the only purpose is to test the deployment itself.
Getting Started
To get started, you can install the module from the PowerShell Gallery:
1
Install-Module PSWattTime
Login to Azure Powershell:
1
Login-AzAccount
Register an account at WattTime.org and login to WattTime.org:
1
2
3
4
5
6
7
8
New-WattTimeAccount -Username <YOUR_USERNAME> `
-Password '<YOUR_PASSWORD>' `
-Email '<you@domain.com>' `
-Organization <YOUR_ORGANIZATION>
$token = Get-WattTimeAuthToken -Username '<YOUR_WATTTIME_USERNAME>' `
-Password '<YOUR_WATTTIME_PASSWORD>'
Then you can query the API for the carbon emissions of a given Azure region:
1
Get-WattTimeForAzureRegion -Region westeurope -AuthToken $token