diff --git a/docs/user-guide/providers/azure/authentication.mdx b/docs/user-guide/providers/azure/authentication.mdx index 47a5b7ecc4..0c3420583f 100644 --- a/docs/user-guide/providers/azure/authentication.mdx +++ b/docs/user-guide/providers/azure/authentication.mdx @@ -294,9 +294,9 @@ Alternatively, point Prowler at a certificate file on disk: prowler azure --certificate-auth --certificate-path /path/to/prowler.key ``` -## Service Principal Application Authentication (Recommended) +## Service Principal Application Authentication -This method is required for Prowler Cloud and recommended for Prowler CLI. +This client-secret flow is the supported fallback when [Certificate Authentication](#certificate-authentication) is not an option — for example on sovereign clouds where the Deploy to Azure quick-start is unavailable, or when an organisation policy forbids certificate-based service principals. New Prowler Cloud onboardings should prefer certificate authentication. ### Creating the Service Principal For more information, see [Creating Prowler Service Principal](/user-guide/providers/azure/create-prowler-service-principal). diff --git a/docs/user-guide/providers/azure/getting-started-azure.mdx b/docs/user-guide/providers/azure/getting-started-azure.mdx index debdf9ee89..77e02ebfeb 100644 --- a/docs/user-guide/providers/azure/getting-started-azure.mdx +++ b/docs/user-guide/providers/azure/getting-started-azure.mdx @@ -57,7 +57,7 @@ Azure supports two authentication methods in the add-provider wizard. Prowler Cl #### Certificate Authentication (Recommended) -The one-click flow: click **Deploy to Azure** in the wizard and let the Bicep template create the App Registration / Service Principal, the `Reader` role assignment, and the custom `ProwlerRole` with a certificate credential in a single deployment. +The quick-start flow: click **Deploy to Azure** in the wizard to start a deployment in the Azure Portal with the Prowler Bicep template pre-loaded. The template creates the App Registration / Service Principal, the `Reader` role assignment, and the custom `ProwlerRole` bound to a certificate credential. You still fill the certificate parameter and confirm the deployment inside the Portal. 1. In the Azure wizard, select **Certificate Authentication (Recommended)**. 2. Click the **Deploy to Azure** button. This opens the Azure Portal deployment blade pre-loaded with the [Prowler Bicep template](https://github.com/prowler-cloud/prowler/blob/master/permissions/templates/azure/bicep/prowler-scan.bicep). diff --git a/prowler/providers/azure/azure_provider.py b/prowler/providers/azure/azure_provider.py index fee7fb16bf..7c7f01b2a1 100644 --- a/prowler/providers/azure/azure_provider.py +++ b/prowler/providers/azure/azure_provider.py @@ -1188,13 +1188,15 @@ class AzureProvider(Provider): ) # since that exception is not considered as critical, we keep filling another identity fields if isinstance(credentials, CertificateCredential): - # `getenv("AZURE_CLIENT_ID", default=client_id)` already - # covers both the env-var cert-auth path (env is set) and - # the static-credentials path (constructor param supplied - # `client_id`). Reaching into `credentials._client_id` - # would be the same class of azure-identity private state - # we deliberately avoided for the thumbprint. - identity.identity_id = getenv("AZURE_CLIENT_ID", default=client_id) + # Prefer the explicit constructor param over the ambient + # env var: with static credentials the caller has + # unambiguously said "this is the client id" and using + # the env var could silently substitute another + # principal's id if the shell happens to have + # `AZURE_CLIENT_ID` set. Fall back to the env var only + # for the env-only cert-auth path where `client_id` is + # `None`. + identity.identity_id = client_id or getenv("AZURE_CLIENT_ID") identity.identity_type = "Service Principal with Certificate" # The SHA-1 thumbprint is computed from the certificate # bytes by `_compute_certificate_thumbprint` at diff --git a/ui/components/providers/workflow/forms/select-credentials-type/azure/credentials-type/azure-certificate-credentials-form.tsx b/ui/components/providers/workflow/forms/select-credentials-type/azure/credentials-type/azure-certificate-credentials-form.tsx index d9c539df94..458ae88c4a 100644 --- a/ui/components/providers/workflow/forms/select-credentials-type/azure/credentials-type/azure-certificate-credentials-form.tsx +++ b/ui/components/providers/workflow/forms/select-credentials-type/azure/credentials-type/azure-certificate-credentials-form.tsx @@ -75,9 +75,10 @@ export const AzureCertificateCredentialsForm = ({ Certificate Authentication (Recommended)
- Generate a self-signed X.509 certificate right in your browser. The
- private key is generated locally and goes straight
- into the field below (it is then submitted with the rest of the
- form). The public certificate downloads as a text file for you to
- paste into the Bicep Certificate Base64 parameter in
- the Portal.
+ Generate a self-signed X.509 certificate right in your browser.
+
+ {" "}
+ The certificate and private key are generated locally
+
+ . The base64-encoded certificate/private-key bundle goes into the
+ field below and is submitted with the rest of the form. The public
+ certificate downloads as a text file for you to paste into the Bicep{" "}
+ Certificate Base64 parameter in the Portal.
{generatorError}
)} {generatedThumbprint && (
- Done. Certificate SHA-1 thumbprint: {generatedThumbprint}
- . Downloaded prowler-cert-base64.txt — paste its
- contents into the Bicep Certificate Base64 parameter,
- then keep filling the fields below.
+ Done. Certificate SHA-1 thumbprint:{" "}
+ {generatedThumbprint}. Downloaded{" "}
+ prowler-cert-base64.txt — paste its contents into the
+ Bicep Certificate Base64 parameter, then keep filling
+ the fields below.