From 37e180827ac0afd06db719d24263888a1f3529bc Mon Sep 17 00:00:00 2001 From: Nacho Rivera Date: Tue, 6 Jun 2023 17:31:43 +0200 Subject: [PATCH] fix(azure): fix empty subscriptions case (#2455) --- prowler/providers/azure/azure_provider.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/prowler/providers/azure/azure_provider.py b/prowler/providers/azure/azure_provider.py index 9bd28a86..2f054ec9 100644 --- a/prowler/providers/azure/azure_provider.py +++ b/prowler/providers/azure/azure_provider.py @@ -168,6 +168,13 @@ class Azure_Provider: ) identity.subscriptions.update({subscription.display_name: id}) + # If there are no subscriptions listed -> checks are not going to be run against any resource + if not identity.subscriptions: + logger.critical( + "It was not possible to retrieve any subscriptions, please check your permission assignments" + ) + sys.exit(1) + tenants = subscriptions_client.tenants.list() for tenant in tenants: identity.tenant_ids.append(tenant.tenant_id)