Microsoft Integrations - Authentication
Security Awareness: Device Code Authorization
It is recommended to use the client credentials and user authorization flows for integrations when possible. The device code authorization flow has limited protections against sophisticated phishing campaigns.
In no scenario emails or other forms of communication will be sent to the customer asking to enter a security code or follow a link. All generated links and codes will be shown in the War Room, by running the official integration commands.
More info at: Device Code flow - Evolved phishing
Microsoft's integrations (Graph and Azure) in Cortex XSOAR use Azure Active Directory applications to authenticate with Microsoft APIs. These integrations use OAuth 2.0 and OpenID Connect standard-compliant authentication services, which use an Application to sign-in or delegate authentication. For more information, see the Microsoft identity platform overview.
There are three application authentication methods available:
#
Cortex XSOAR ApplicationIn this method, you grant consent for the Cortex XSOAR multi-tenant application to access your data. The application is maintained by Cortex XSOAR. Depending on the integration, this requires either admin consent to get access without a user or user consent to get access on behalf of a user.
Note: This method requires that you give consent to all permissions requested by the application.
To start the authentication process, go to the integration's detailed instructions:
Navigate to Settings > Integration > Servers & Services.
Search for wanted Microsoft integration, e.g.
O365 Outlook Mail (Using Graph API)
.Click Add instance.
Click the Link that appears in the Help section:.
In the XSOAR Web Page that appears, click the Start Authorization Process button to initiate the authorization flow. You will receive your ID, token, and key. You need to enter this information, when you configure the integration instance in Cortex XSOAR.
#
Self Deployed ApplicationTo use a self-configured Azure application, you need to add a new Azure App Registration in the Azure Portal.
The application must have the required permissions for the relevant APIs, which are documented in the integration documentation, for example see Microsoft Defender Advanced Threat Protection required permissions.
To add the registration, refer to the Microsoft documentation
#
Using National CloudTo see which integrations support natively National Clouds,See the table below.
- For Microsoft Azure integrations, select the appropriate cloud using the Azure Cloud parameter.
- For Microsoft Defender, select the appropriate cloud using the Endpoint Type parameter.
- For using the self-deployment option, select the Custom option and follow the instructions below.
Some Cortex XSOAR-Microsoft integrations support the deployment of national clouds through the self-deployed authorization flow. For more information about Microsoft National Clouds, refer to the Microsoft documentation. In order to use a national cloud, change the Server URL parameter to the corresponding address of the national cloud you are using.
#
Client Credentials FlowSome Cortex XSOAR-Microsoft integrations use the client credentials flow. The Tenant ID, Client ID, and Client secret are required for the integration.
To configure a Microsoft integration that uses this authorization flow with a self-deployed Azure application:
- Enter your client ID in the ID parameter field.
- Enter your client secret in the Key parameter field.
- Enter your tenant ID in the Token parameter field.
- Select the Use a self-deployed Azure Application checkbox in the integration instance configuration.
- Test and Save the instance.
Alternatively, instead of providing the Client Secret, you can authenticate using certificate credentials by providing:
#
Authorization Code flowSome Cortex XSOAR-Microsoft integrations (e.g., Microsoft Graph Mail Single User) require authorization on behalf of a user (not admin consent). For more information about this authorization flow, refer to the authorization code flow.
To configure a Microsoft integration that uses this authorization flow with a self-deployed Azure application:
Make sure the needed permissions are granted for the app registration, e.g., for Microsoft Graph User: API/Permission name
Directory.AccessAsUser.All
of typeDelegated
.In your app. click Authentication > Platform configurations > Add a platform. Choose Web and add Redirect URI. The Redirect URI can direct any web application that you wish to receive responses from Azure AD. If you are not sure what to set, you can use
https://localhost
.Enter your client ID in the ID parameter field.
Enter your client secret in the Key parameter field.
Enter your tenant ID in the Token parameter field.
Enter your redirect URI in the Redirect URI parameter field.
Select the Use a self-deployed Azure Application checkbox in the integration instance configuration.
Save the instance.
Run the
!<integration command prefix>-generate-login-url
command in the War Room and follow the instructions:- Click on the login URL to sign in and grant Cortex XSOAR permissions for your Azure Service Management.
You will be automatically redirected to a link with the following structure:
REDIRECT_URI?code=AUTH_CODE&session_state=SESSION_STATE
- Copy the
AUTH_CODE
(without thecode=
prefix, and thesession_state
parameter) and paste it in your instance configuration under the Authorization code parameter. - For any issues, see Authorization Code flow Troubleshooting.
- Click on the login URL to sign in and grant Cortex XSOAR permissions for your Azure Service Management.
You will be automatically redirected to a link with the following structure:
Save the instance.
Run the
!<integration command prefix>-auth-test
command. A 'Success' message should be printed to the War Room.
#
Device Code FlowSome Cortex XSOAR-Microsoft integrations use the device code flow.
To configure a Microsoft integration that uses this authorization flow with a self-deployed Azure application:
Make sure the needed permissions are granted for the app registration.
The Redirect URI can direct any web application that you wish to receive responses from Azure AD. If you are not sure what to set, you can use
https://localhost
.In Supported account types, Accounts in any organizational directory (Any Azure AD directory - Multi-tenant) should be selected.
In the app registration, navigate to Authentication > Advanced Settings, and enable the mobile and desktop flows.
Enter your application ID in the Application ID parameter field.
Run the
!<integration command prefix>-auth-start
command - you will be prompted to open the page https://microsoft.com/devicelogin and enter the generated code.Run the
!<integration command prefix>-auth-complete
command.Run the
!<integration command prefix>-auth-test
command to ensure connectivity to Microsoft.
#
Azure Managed Identities Authentication#
Note: This option is relevant only if the integration is running on Azure VM.Some of the Cortex XSOAR-Microsoft integrations use the Azure Managed Identities Authentication.
Follow one of these steps for authentication based on Azure Managed Identities:
#
To use System Assigned Managed Identity- Select Azure Managed Identities from the Authentication Type drop down or select the Use Azure Managed Identities checkbox and leave the Azure Managed Identities Client ID field empty.
#
To use User Assigned Managed Identity- Go to Azure Portal -> Managed Identities.
- Select your User Assigned Managed Identity -> copy the Client ID -> paste it in the Azure Managed Identities Client ID field in the instance settings.
- Select Azure Managed Identities from the Authentication Type drop down or select the Use Azure Managed Identities checkbox.
#
Revoke ConsentIn order to revoke consent to a Cortex XSOAR Microsoft application, refer to the Microsoft documentation.
#
Azure Integrations ParametersIn order to use the Cortex XSOAR Azure application, you need to fill in your subscription ID and resource group name, which you can find in the Azure Portal.
Log in to the Azure Portal Home Page using your Azure credentials.
Search for your Azure product, for example SQL Servers:
Click on your resource:
After you a redirected to the next page, in the Overview tab you will find your Resource group and Subscription ID:
Microsoft Graph User integration#
Self Deployed Application - Example forIn Microsoft Azure portal, create a new app registration.
Select Azure Active Directory> App registrations> New registration.
In the Redirect URI (optional) field select Web and type a name (you can enter an arbitrary name). In this example we use https<nolink>://xsoar.
Click Register.
You can see the Essential information here:
Copy the following information:
- Application (client) ID
- Directory (tenant) ID
Get the client secret, which is used for the key in the integration settings.
Click Certificate and secrets -> New client secret.
Copy the client secret.
Ensure the needed permissions are granted for the app registration.
Go to API permissions>Add a permission>Microsoft Graph>Delegated permissions and search for
Directory.AccessAsUser.All
of typeDelegated
.Click Add permissions.
NOTE: Ensure that you have the following permissions:
- Directory.Read.All - Delegated
- User.ReadWrite.All - Application
- User.Read - Delegated
Get the authorization code.
Type the following in a browser:
https://login.microsoftonline.com/<tenant_id\>/oauth2/v2.0/authorize?response_type=code&scope=offline_access%20directory.accessasuser.all&client_id=*<client_id\>*&redirect_uri=https%3A%2F%2Fxsoar
Replace
tenant_id
andclient-id
with the tenant ID that was generated in step 1.iv.The URI is the https<nolink>://xsoar.
This prompts the admin user to sign in and grant the app the appropriate permissions:
Once completed you are redirected to the redirect URI and will receive an authorization code in the query parameters of the URI.
NOTE: If there are multiple query parameters returned you should just copy the code value.
Copy the AUTH_CODE (without the "code=" prefix). This value must be used in the MS Graph User in Cortex XSOAR integration in the Authorization Code field.
Add the information to the instance in Cortex XSOAR by going to Settings>Integrations>Microsoft Graph User>Add Instance.
- In the ID parameter field, type the client ID.
- in the Token parameter field, type the tenant ID.
- In the Key parameter field, type your client secret.
- Click the Use a self-deployed Azure application checkbox.
- In the Redirect URI field, type the redirect URI we are entering at the Azure portal.
- In the Authorization code for self-deployed mode - received from the authorization step, type the code that was generated in 4.2.
- Save the integration settings and test the setup by running the !msgraph-user-test command from the Cortex XSOAR CLI.
#
Supported Authentication Flows for Microsoft integrationsIntegration Name | XSOAR Application | Client Credentials | Device Code | Auth code (redirect URI) | Azure Managed Identities | Supports National Clouds |
---|---|---|---|---|---|---|
Azure Compute v2 | yes | yes | no | no | no | no |
Azure Data Explorer | yes - device | yes | yes | yes | no | no |
AzureDevOps | yes | yes | yes | yes | no | no |
Azure Firewall | yes | yes | yes | no | yes | no |
Azure Key Vault | no | yes | no | no | yes | yes |
Azure Kubernetes Services | yes | yes | yes | yes | yes | yes |
Azure Log Analytics | yes | yes | no | yes | yes | yes |
Azure Network Security Groups | yes | yes | yes | yes | yes | no |
Azure Risky Users | yes | yes | yes | no | yes | no |
Azure Security Center v2 | yes | yes | no | no | yes | no |
Microsoft Defender for Cloud Event Collector | no | yes | no | no | no | no |
Azure Sentinel | no | yes | no | no | yes | yes |
Azure SQL Management | yes | yes | yes | yes | yes | no |
Azure Storage | yes | yes | yes | yes | yes | no |
Azure Storage Container | no | no | no | no | yes | no |
Azure Storage FileShare | no | no | no | no | no | no |
Azure Storage Queue | no | no | no | no | yes | no |
Azure Storage Table | no | no | no | no | yes | no |
Azure Web Application Firewall | yes | yes | yes | yes | yes | no |
Microsoft 365 Defender | yes | yes | yes | no | yes | no |
Microsoft 365 Defender Event Collector - XSIAM | no | yes | no | no | no - saas | no |
Microsoft Defender for Cloud Apps | no | yes | yes | no | no | yes |
Microsoft Defender for Endpoint (Defender ATP) | yes | yes | no | yes | yes | yes |
Microsoft Graph API | yes | yes | yes | yes | yes | yes |
Azure Active Directory Applications | yes - device | yes | yes | no | yes | no |
O365 Outlook Calendar | yes | yes | no | no | yes | no |
Microsoft Graph Device Management | yes | yes | no | no | yes | yes |
O365 File Management | yes | yes | no | yes | yes | no |
Microsoft Graph Groups | yes | yes | no | yes | yes | no |
Azure Active Directory Identity And Access | yes | yes | yes | no | yes | no |
Microsoft Graph Mail Single User | yes | no | no | yes | yes | no |
O365 Outlook Mail | yes | yes | no | no | yes | yes |
Microsoft Graph Security | yes | yes | no | yes | yes | no |
Microsoft Graph User | yes | yes | no | yes | yes | no |
Microsoft Management Activity API (O365 Azure Events) | yes | no | no | yes | yes | no |
Microsoft Teams | no | yes | no | yes | no | no |
Microsoft Teams Management | yes | yes | yes | no | yes | no |
#
Troubleshooting#
Reset authenticationIn case of errors in the authentication process, such as a token revoked/expired or in case you generate new credentials,
you can use the !<integration command prefix>-auth-reset
command in the War Room in order to rerun the authentication process,
instead of recreating a new integration instance.
After running the command, click Test to verify the connectivity of the instance.
For example, when using the "self-deployed Azure app" for Microsoft Graph Mail Single User, in case of an expired/revoked token error:
- Run !msgraph-mail-auth-reset.
- Validate that all the credentials you entered are correct (Client ID, Client Secret, Tenant ID, Application redirect URI).
- Run !msgraph-mail-generate-login-url to generate a new Authorization code. See Authorization Code flow Troubleshooting.
- Run !msgraph-mail-test to test the connectivity of the email.
Note: If encountering an "Insufficient privileges to complete the operation" error, ensure the necessary permissions were added according to the integration documentation. Subsequently, reset the authentication and initiate the authentication process again.
#
Authorization Code flow TroubleshootingIf you encounter issues with the User consent, such as a "Missing scope permissions on the request. API requires one of..." error after generating a new authorization code using the generate-login-url command, even though you have provided all the mentioned permissions, it may indicate that you need to trigger the consent process again.
To do this, copy the login URL, add &prompt=consent
to the end of the URL, and then log in.
For details, see Microsoft's documentation on Request an authorization code.