# Application ID and Certificate

> * Runs: as background service.
* Scenario: attended, unattended, and unattended with MFA enabled.
* Application permissions.
* Recommended for unattended executions or when you want to access the Microsoft Graph API as an application (a background service / daemon) without a signed-in user.

## Overview

* Runs: as background service.
* Scenario: attended, unattended, and unattended with MFA enabled.
* Application permissions.
* Recommended for unattended executions or when you want to access the Microsoft Graph API as an application (a background service / daemon) without a signed-in user.

## Details

* When registering your application, you must select an application type. For application ID and certificate authentication type, use a web application (which uses [OAuth 2.0 client credentials flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow)).

* This authentication method is similar to Application ID and secret, but it uses a certificate as a secret instead of a client secret string.

## Using certificates

To authenticate using a certificate as a secret, take the following steps:

1. In the Azure portal:
   * Locate your registered Microsoft 365 application.
   * Select **Certificates & secrets** and upload your certificate (public key) file. It can have one of the following file types: `.cer`, `.pem`, `.crt`.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/certificates-9aaad2c0.webp)
2. Convert the raw contents of your `.pfx` file representing the certificate to a `base64 string`. You can assign the `Convert.ToBase64String(System.IO.File.ReadAllBytes(pfxFilePath))` value to a `String` variable.
3. In the **Microsoft 365 Scope** activity:

* Set **Authentication Type** to **Application ID and Certificate**.
* Set **Certificate as Base64** to the base64 representation of the certificate.
* If a password is required to use the certificate, set the value for the **Certificate Password** property as well.

For more details, check the following resources:

* [Microsoft 365 Scope](https://docs.uipath.com/activities/other/latest/productivity/microsoft-office-365-scope)
* [OAuth application setup](https://docs.uipath.com/activities/other/latest/productivity/oauth-application-setup#oauth-application-setup)
