-
Notifications
You must be signed in to change notification settings - Fork 0
Quickstart PowerShell Module
This PowerShell module is intended for retrieving emissions data from CO2signal for a supplied Azure Region during resource deployments. This is a lightweight solution making use of only the limited functionality available with a free account at CO2signal. This means the module is only able to get near-realtime emissions data and no prodictive values. This means this module is not a real solution for reduced carbon deployments and -software. It does however provide some nice realtime values so you can simulate the beheaviour of deployments and software based on emissions data without the cost of a paid account for such data. For example in lab- or proof of concept environments.
To get started with this module you will need an account on CO2signal. See the website for details on registering and the conditions that apply.
Once you have an account, you will need to create an API token. This can be done in the API section of your account. You will need to copy the token and store it in a secure location. You will need to supply this token to the module when you use it.
The module is available on the PowerShell Gallery. You can install it using the following command:
Install-Module -Name PSCO2SignalOnce installed, you can import the module using the following command:
Import-Module -Name PSCO2SignalPS C:\> Get-CO2SignalForAzureRegion -Region westeurope -AuthToken $token
Region : westeurope
FossilFuelPercentage : 29.37
CountryCode : NL
CarbonIntensity : 231
CarbonIntensityUnit : gCO2eq/kWh
Timestamp : 3/26/2023 8:00:00 AM
Determine the lowest emissions for the list of northeurope, westeurope, francecentral and uksouth Azure regions:
PS C:\> Get-CO2SignalBestAzureRegion -Regions westeurope,uksouth,northeurope,francecentral -AuthToken $token
Region : westeurope
FossilFuelPercentage : 29.37
CountryCode : NL
CarbonIntensity : 231
CarbonIntensityUnit : gCO2eq/kWh
Timestamp : 3/26/2023 8:00:00 AM