{"id":13739036,"url":"https://github.com/cloudyspells/PSElectricityMaps","last_synced_at":"2025-05-08T18:31:42.659Z","repository":{"id":148806033,"uuid":"620813652","full_name":"cloudyspells/PSElectricityMaps","owner":"cloudyspells","description":"PowerShell Module for free ElectricityMaps API functions for Azure","archived":false,"fork":false,"pushed_at":"2023-09-04T13:09:59.000Z","size":51,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-10T21:16:03.023Z","etag":null,"topics":["azure","carbon-emissions","carbon-footprint","co2","co2-emissions","co2-signal","github-actions","green-software","powershell","powershell-module","sustainability"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudyspells.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2023-03-29T12:27:54.000Z","updated_at":"2024-10-16T04:52:01.000Z","dependencies_parsed_at":"2023-06-09T01:00:22.160Z","dependency_job_id":null,"html_url":"https://github.com/cloudyspells/PSElectricityMaps","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"b7b0637e2a58a369316cfdc631eec52449bf8900"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPSElectricityMaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPSElectricityMaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPSElectricityMaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPSElectricityMaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudyspells","download_url":"https://codeload.github.com/cloudyspells/PSElectricityMaps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224758093,"owners_count":17364953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","carbon-emissions","carbon-footprint","co2","co2-emissions","co2-signal","github-actions","green-software","powershell","powershell-module","sustainability"],"created_at":"2024-08-03T04:00:23.638Z","updated_at":"2024-11-15T09:30:18.404Z","avatar_url":"https://github.com/cloudyspells.png","language":"PowerShell","funding_links":[],"categories":["Green Software Awesome List"],"sub_categories":["Contents"],"readme":"# PSElectricityMaps\n\n## PowerShell Module for ElectricityMaps emission data\n\n[![PowerShell Module Quality Assurance](https://github.com/cloudyspells/PSElectricityMaps/actions/workflows/qa.yml/badge.svg)](https://github.com/cloudyspells/PSElectricityMaps/actions/workflows/qa.yml)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/cloudyspells/PSElectricityMaps)\n![PowerShell Gallery Version](https://img.shields.io/powershellgallery/v/PSElectricityMaps)\n![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/PSElectricityMaps)\n\n\nThis PowerShell module is intended for retrieving emissions data from\n[CO2 Signal](https://www.co2signal.com/) for a supplied Azure Region during\nresource deployments. This is a lightweight solution making use of non-commercial\nfunctionality available with a free account at _ElectricityMaps_. This means\nthe module is only able to get near-realtime emissions data and no prodictive\nvalues. This means this module is _not_ a real solution for reduced carbon\ndeployments and -software. It _does_ however provide some nice realtime values\nso you can simulate the beheaviour of deployments and software based on \nemissions data without the cost of a paid account for such data. For example in\nlab- or proof of concept environments.\n\nThe intended use of this module is for setting the `Location` parameter\non Azure IaC deployments in GitHub workflows using the included GitHub\naction.\n\nFor a real-world solution with a commercial data provider, check out\nthe [carbon-aware-sdk](https://github.com/Green-Software-Foundation/carbon-aware-sdk)\nby the [Green Software Foundation](https://greensoftware.foundation/)\n\n**NOTE:** ElectricityMaps is currently migrating from \n[co2signal.com](http://www.co2signal.com). Until migration is finished you will\nhave to register a new account there. The module's API calls also still point to\n_co2signal.com_ and will be updated by the author as migration proceeds.\n\n### Usage\n\n#### PowerShell Module\n\nTo get started with this module you will need an account on\n[ElectricityMaps](https://www.ElectricityMaps.com/). See the website for details on\nregistering and the conditions that apply.\n\nYou will also need the _Az.Resources_ PowerShell Module for Azure installed\nand connected to your Azure account. See\n[the installation manual](https://learn.microsoft.com/en-us/powershell/azure/install-az-ps)\nfor the _Az_ module for instructions.\n\nTo install the module from the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSElectricityMaps/).\n\n```powershell\nInstall-Module -Name PSElectricityMaps\n```\n\nGet current percentage of energy with emissions the 'westeurope' Azure region:\n\n```powershell\nPS C:\\\u003e Get-ElectricityMapsForAzureRegion -Region westeurope -AuthToken $token\n\nRegion               : westeurope\nFossilFuelPercentage : 29.37\nCountryCode          : NL\nCarbonIntensity      : 231\nCarbonIntensityUnit  : gCO2eq/kWh\nTimestamp            : 3/26/2023 8:00:00 AM\n\n```\n\nDetermine the lowest emissions for the list of northeurope,\nwesteurope, francecentral and uksouth Azure regions:\n\n```powershell\nPS C:\\\u003e Get-ElectricityMapsBestAzureRegion -Regions westeurope,uksouth,northeurope,francecentral -AuthToken $token\n\nRegion               : westeurope\nFossilFuelPercentage : 29.37\nCountryCode          : NL\nCarbonIntensity      : 231\nCarbonIntensityUnit  : gCO2eq/kWh\nTimestamp            : 3/26/2023 8:00:00 AM\n\n```\n\n##### Module Functions\n\n- [Get-ElectricityMapsForAzureRegion](docs/Get-ElectricityMapsForAzureRegion.md)\n- [Get-ElectricityMapsBestAzureRegion](docs/Get-ElectricityMapsBestAzureRegion.md)\n\n#### GitHub Action\n\nThis PowerShell module also comes with a _GitHub Action_ you can use\nin your GitHub workflows. Again you will need a pre-existing account\nfor _ElectricityMaps_ and an Azure CLI/PowerShell secret configured in your repo\n\n##### Example\n\n```yaml\n\non:\n  pull_request:\n    branches:\n      - 'main'\n      - 'releases/**'\n\nname: Deploy to region with lowest emissions\n\njobs:\n  deploy-to-test:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n\n      - name: Get region with lowest emissions\n        uses: cloudyspells/PSElectricityMaps@main\n        id: signal_action # Set step id for using output in deployment\n        with:\n          azure_credential: ${{ secrets.AZURE_CREDENTIALS }}\n          signal_token: ${{ secrets.SIGNALTOKEN }}\n          regions: '\"westeurope\",\"northeurope\",\"uksouth\",\"francecentral\",\"germanynorth\"'\n\n      - name: Login to Az PowerShell Module\n        uses: azure/login@v1\n        with:\n          creds: ${{ secrets.AZURE_CREDENTIALS }}\n          enable-AzPSSession: true\n\n      - uses: azure/arm-deploy@v1\n        name: Run Bicep deployment\n        with:\n          subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}\n          scope: subscription\n          region: ${{ steps.signal_action.outputs.region }} # The region output from PSElectricityMaps\n          template: src/bicep/main.bicep\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudyspells%2FPSElectricityMaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudyspells%2FPSElectricityMaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudyspells%2FPSElectricityMaps/lists"}