github.com/argoproj/argo-cd@v1.8.7/docs/operator-manual/user-management/microsoft.md (about)

     1  # Microsoft
     2  
     3  * [Azure AD SAML Enterprise App Auth using Dex](#azure-ad-saml-enterprise-app-auth-using-dex)
     4  * [Azure AD App Registration Auth using OIDC](#azure-ad-app-registration-auth-using-oidc)
     5  * [Azure AD App Registration Auth using Dex](#azure-ad-app-registration-auth-using-dex)
     6  
     7  ## Azure AD SAML Enterprise App Auth using Dex
     8  
     9  ### Configure a new Azure AD Enterprise App
    10  
    11  1. From the `Azure Active Directory` > `Enterprise applications` menu, choose `+ New application`
    12  2. Select `Non-gallery application`
    13  3. Enter a `Name` for the application (eg. `Argo CD`), then choose `Add`
    14  4. Once the application is created, open it from the `Enterprise applications` menu.
    15  5. From the `Users and groups` menu of the app, add any users or groups requiring access to the service.
    16  
    17     ![Azure Enterprise SAML Users](../../assets/azure-enterprise-users.png "Azure Enterprise SAML Users")
    18  
    19  6. From the `Single sign-on` menu, edit the `Basic SAML Configuration` section as follows (replacing `my-argo-cd-url` with your Argo URL):
    20     - **Identifier (Entity ID):** https://`<my-argo-cd-url>`/api/dex/callback
    21     - **Reply URL (Assertion Consumer Service URL):** https://`<my-argo-cd-url>`/api/dex/callback
    22     - **Sign on URL:** https://`<my-argo-cd-url>`/auth/login
    23     - **Relay State:** `<empty>`
    24     - **Logout Url:** `<empty>`
    25  
    26     ![Azure Enterprise SAML URLs](../../assets/azure-enterprise-saml-urls.png "Azure Enterprise SAML URLs")
    27  
    28  7. From the `Single sign-on` menu, edit the `User Attributes & Claims` section to create the following claims:
    29     - `+ Add new claim` | **Name:** email | **Source:** Attribute | **Source attribute:** user.mail
    30     - `+ Add group claim` | **Which groups:** All groups | **Source attribute:** Group ID | **Customize:** True | **Name:** Group | **Namespace:** `<empty>` | **Emit groups as role claims:** False
    31     - *Note: The `Unique User Identifier` required claim can be left as the default `user.userprincipalname`*
    32  
    33     ![Azure Enterprise SAML Claims](../../assets/azure-enterprise-claims.png "Azure Enterprise SAML Claims")
    34  
    35  8. From the `Single sign-on` menu, download the SAML Signing Certificate (Base64)
    36     - Base64 encode the contents of the downloaded certificate file, for example:
    37     - `$ cat ArgoCD.cer | base64`
    38     - *Keep a copy of the encoded output to be used in the next section.*
    39  9. From the `Single sign-on` menu, copy the `Login URL` parameter, to be used in the next section.
    40  
    41  ### Configure Argo to use the new Azure AD Enterprise App
    42  
    43  1. Edit `argo-cm` and add the following `dex.config` to the data section, replacing the `caData`, `my-argo-cd-url` and `my-login-url` your values from the Azure AD App:
    44  
    45  ```
    46  data:
    47    url: https://my-argo-cd-url
    48    dex.config: |
    49      logger:
    50        level: debug
    51        format: json
    52      connectors:
    53      - type: saml
    54        id: saml
    55        name: saml
    56        config:
    57          entityIssuer: https://my-argo-cd-url/api/dex/callback
    58          ssoURL: https://my-login-url (eg. https://login.microsoftonline.com/xxxxx/a/saml2)
    59          caData: |
    60            MY-BASE64-ENCODED-CERTIFICATE-DATA
    61          redirectURI: https://my-argo-cd-url/api/dex/callback
    62          usernameAttr: email
    63          emailAttr: email
    64          groupsAttr: Group
    65  ```
    66  
    67  2. Edit `argo-rbac-cm` to configure permissions, similar to example below.
    68  
    69     - Use Azure AD `Group IDs` for assigning roles.
    70     - See [RBAC Configurations](../rbac.md) for more detailed scenarios.
    71  
    72  ```
    73  # example policy
    74  policy.default: role:readonly
    75    policy.csv: |
    76      p, role:org-admin, applications, *, */*, allow
    77      p, role:org-admin, clusters, get, *, allow
    78      p, role:org-admin, repositories, get, *, allow
    79      p, role:org-admin, repositories, create, *, allow
    80      p, role:org-admin, repositories, update, *, allow
    81      p, role:org-admin, repositories, delete, *, allow
    82      g, "84ce98d1-e359-4f3b-85af-985b458de3c6", role:org-admin # (azure group assigned to role)
    83  ```
    84  
    85  ## Azure AD App Registration Auth using OIDC
    86  
    87  1. Register a new Azure AD Application
    88  
    89      [Quickstart: Register an application](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)
    90  
    91          App Registrations Inputs
    92              Redirect URI: https://argocd.example.com/auth/callback
    93          Outputs
    94              Application (client) ID: aaaaaaaa-1111-bbbb-2222-cccccccccccc
    95              Directory (tenant) ID: 33333333-dddd-4444-eeee-555555555555
    96              Secret: some_secret
    97  
    98  2. Setup permissions for Azure AD Application
    99  
   100      On "API permissions" page find `User.Read` permission (under `Microsoft Graph`) and grant it to the created application:
   101  
   102      ![Azure AD API permissions](../../assets/azure-api-permissions.png "Azure AD API permissions")
   103  
   104      Also, on "Token Configuration" page add groups claim for the groups assigned to the application:
   105  
   106      ![Azure AD token configuration](../../assets/azure-token-configuration.png "Azure AD token configuration")
   107  
   108  3. Edit `argocd-cm` and configure the `data.oidc.config` section:
   109  
   110          ConfigMap -> argocd-cm
   111  
   112          data:
   113              url: https://argocd.example.com/
   114              oidc.config: |
   115                  name: Azure
   116                  issuer: https://login.microsoftonline.com/{directory_tenant_id}/v2.0
   117                  clientID: {azure_ad_application_client_id}
   118                  clientSecret: $oidc.azure.clientSecret
   119                  requestedIDTokenClaims:
   120                      groups:
   121                          essential: true
   122                  requestedScopes:
   123                      - openid
   124                      - profile
   125                      - email
   126  
   127  4. Edit `argocd-secret` and configure the `data.oidc.azure.clientSecret` section:
   128  
   129          Secret -> argocd-secret
   130  
   131          data:
   132              oidc.azure.clientSecret: {client_secret | base64_encoded}
   133  
   134  5. Edit `argocd-rbac-cm` to configure permissions. Use group ID from Azure for assigning roles
   135  
   136      [RBAC Configurations](../rbac.md)
   137  
   138          ConfigMap -> argocd-rbac-cm
   139  
   140          policy.default: role:readonly
   141          policy.csv: |
   142              p, role:org-admin, applications, *, */*, allow
   143              p, role:org-admin, clusters, get, *, allow
   144              p, role:org-admin, repositories, get, *, allow
   145              p, role:org-admin, repositories, create, *, allow
   146              p, role:org-admin, repositories, update, *, allow
   147              p, role:org-admin, repositories, delete, *, allow
   148              g, "84ce98d1-e359-4f3b-85af-985b458de3c6", role:org-admin
   149  
   150  6. Mapping role from jwt token to argo
   151  
   152      If you want to map the roles from the jwt token to match the default roles (readonly and admin) then you must change the scope variable in the rbac-configmap.
   153  
   154          scopes: '[roles, email]'
   155  
   156  ## Azure AD App Registration Auth using Dex
   157  
   158  Configure a new AD App Registration, as above.
   159  
   160  Then, add the `dex.config` to `argocd-cm`:
   161  
   162  ```yaml
   163  ConfigMap -> argocd-cm
   164  
   165  data:
   166      dex.config: |
   167        connectors:
   168        - type: microsoft
   169          id: microsoft
   170          name: Your Company GmbH
   171          config:
   172            clientID: $MICROSOFT_APPLICATION_ID
   173            clientSecret: $MICROSOFT_CLIENT_SECRET
   174            redirectURI: http://localhost:8080/api/dex/callback
   175            tenant: ffffffff-ffff-ffff-ffff-ffffffffffff
   176            groups:
   177              - DevOps
   178  ```