diff --git a/.env b/.env index 6f20413..4937a54 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -CR_BASE=ghcr.io/mkoertgen +CR_BASE=ghcr.io/dodevops # Inject semver on CI/CD, `gitversion /showvariable SemVer` GITVERSION_SEMVER=0.1.0 diff --git a/.github/workflows/azure-app-exporter.yml b/.github/workflows/azure-app-exporter.yml index 1aac4f5..b7b39be 100644 --- a/.github/workflows/azure-app-exporter.yml +++ b/.github/workflows/azure-app-exporter.yml @@ -10,7 +10,7 @@ on: jobs: build: - uses: mkoertgen/azure-app-exporter/.github/workflows/_build.yml@main + uses: dodevops/azure-app-exporter/.github/workflows/_build.yml@main with: component: azure-app-exporter secrets: diff --git a/README.md b/README.md index 724f89e..3e204a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![azure-app-exporter](https://github.com/mkoertgen/azure-app-exporter/actions/workflows/azure-app-exporter.yml/badge.svg)](https://github.com/mkoertgen/azure-app-exporter/actions/workflows/azure-app-exporter.yml) +[![azure-app-exporter](https://github.com/dodevops/azure-app-exporter/actions/workflows/azure-app-exporter.yml/badge.svg)](https://github.com/dodevops/azure-app-exporter/actions/workflows/azure-app-exporter.yml) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/azure-app-exporter)](https://artifacthub.io/packages/search?repo=azure-app-exporter) # azure-app-exporter @@ -9,7 +9,7 @@ Exposing Prometheus Metrics for Azure App Registration useful for alerting on ex See [Documentation](_docs/index.md) for more information. -Contribute on the [Project page](https://github.com/users/mkoertgen/projects/1/) +Contribute on the [Project page](https://github.com/users/dodevops/projects/1/) ## Quick Start diff --git a/artifacthub-repo.yml b/artifacthub-repo.yml index 5c08983..a59b899 100644 --- a/artifacthub-repo.yml +++ b/artifacthub-repo.yml @@ -3,3 +3,5 @@ repositoryID: 0ff66d32-280b-4a3c-b7a1-fa2399549cf6 owners: # (optional, used to claim repository ownership) - name: mkoertgen email: marcel.koertgen@gmail.com + - name: dodevops + email: info@dodevops.io \ No newline at end of file diff --git a/charts/azure-app-exporter/Chart.yaml b/charts/azure-app-exporter/Chart.yaml index 3ffc37c..ff76325 100644 --- a/charts/azure-app-exporter/Chart.yaml +++ b/charts/azure-app-exporter/Chart.yaml @@ -2,16 +2,19 @@ apiVersion: v2 name: azure-app-exporter description: Exposing Prometheus Metrics for Azure Service Principals type: application -version: 0.1.0 -appVersion: "0.1.19" +version: 0.2.0 +appVersion: "0.1.35" keywords: - azure - prometheus -home: https://github.com/mkoertgen/azure-app-exporter +home: https://github.com/dodevops/azure-app-exporter sources: - - https://github.com/mkoertgen/azure-app-exporter -icon: https://raw.githubusercontent.com/mkoertgen/azure-app-exporter/main/logo.png + - https://github.com/dodevops/azure-app-exporter +icon: https://raw.githubusercontent.com/dodevops/azure-app-exporter/main/logo.png maintainers: - name: Marcel Körtgen email: marcel.koertgen@gmail.com url: https://github.com/mkoertgen + - name: DO! DevOps + email: info@dodevops.io + url: https://github.com/dodevops diff --git a/charts/azure-app-exporter/README.md b/charts/azure-app-exporter/README.md index 7908b9e..ff06ac6 100644 --- a/charts/azure-app-exporter/README.md +++ b/charts/azure-app-exporter/README.md @@ -4,17 +4,18 @@ Exposing Prometheus Metrics for Azure Service Principals -**Homepage:** +**Homepage:** ## Maintainers -| Name | Email | Url | -| ---- | ------ | --- | +| Name | Email | Url | +|----------------|-----------------------------|--------------------------------| | Marcel Körtgen | | | +| DO! DevOps | | | ## Source Code -* +* ## Values diff --git a/grafana/dashboards/azure-app-exporter.json b/grafana/dashboards/azure-app-exporter.json index 080088f..c5c1c7f 100644 --- a/grafana/dashboards/azure-app-exporter.json +++ b/grafana/dashboards/azure-app-exporter.json @@ -39,7 +39,7 @@ "title": "GitHub", "tooltip": "GitHub", "type": "link", - "url": "https://github.com/mkoertgen/azure-app-exporter" + "url": "https://github.com/dodevops/azure-app-exporter" } ], "liveNow": false, diff --git a/src/api/deps.py b/src/api/deps.py index 7a1542d..beb142c 100644 --- a/src/api/deps.py +++ b/src/api/deps.py @@ -1,5 +1,5 @@ from azure.identity import EnvironmentCredential -from msgraph import GraphServiceClient +from msgraph.graph_service_client import GraphServiceClient from core.config import settings from services.app_service import AppService @@ -13,4 +13,6 @@ def get_app_service() -> AppService: def get_client() -> GraphServiceClient: creds = EnvironmentCredential() + # GraphServiceClient works with EnvironmentCredential just as well + # noinspection PyTypeChecker return GraphServiceClient(credentials=creds) diff --git a/src/services/azure_app_service.py b/src/services/azure_app_service.py index 3409388..cc3953b 100644 --- a/src/services/azure_app_service.py +++ b/src/services/azure_app_service.py @@ -1,11 +1,12 @@ from datetime import datetime from typing import List, Optional -from msgraph import GraphServiceClient +from msgraph.graph_service_client import GraphServiceClient from msgraph.generated.models.application import Application from msgraph.generated.models.key_credential import KeyCredential from msgraph.generated.models.password_credential import PasswordCredential from prometheus_client import Gauge +from prometheus_client import REGISTRY from models import AppRegistration from models.app_registration import Credential @@ -64,6 +65,8 @@ def _map_cred(cred: KeyCredential | PasswordCredential) -> Credential: @staticmethod def observe(apps: List[AppRegistration]): + APP_EXPIRY.clear() + APP_CREDS_EXPIRY.clear() for app in apps: if len(app.credentials) > 0: expiry: Optional[datetime] = min(map(lambda c: c.expires, app.credentials))