summary: Comprehensive guide for configuring OHIF with Microsoft Azure Healthcare APIs, including step-by-step instructions for Azure AD registration, DICOM service setup, CORS configuration, and OAuth authentication implementation.
This guide explains how to configure a DICOM datasource in OHIF using Azure Healthcare APIs. It focuses on the configuration details and parameters necessary for integration.
---
## Configuring Azure Healthcare APIs as a DICOMweb Data Source
Follow these steps to set up Azure as a DICOM datasource for the OHIF Viewer.
4. Under **"Supported account types"**, select **"Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)"**.
5. Enter the following values in your redirect URI tab:

---
### API Permissions:
1. Under your registered application, go to **"API permissions"**.
2. Click **"Add a permission"**.
3. Choose the Azure API for DICOM (**Dicom.ReadWrite**). If you can't find it, refer to the "Configure Azure DICOMWEB Service" section and then return to this step.

---
### Authentication:
1. Under **"Authentication"**, check the **"ID tokens"** box since we are using OpenID Connect.
---
### App Client ID and Tenant ID:
1. Copy your app client ID and tenant ID to prepare for use in configuring an OHIF datasource.
---
### Consent:
1. The first time a user logs in, they will be prompted to consent to the permissions your application has requested.
2. Once they grant consent, your application can use the obtained access token to call the specific Microsoft API on behalf of the user.

---
### Configure Azure DICOMWEB Service:
1.**Create a Health Data Services workspace**:

2. Visit the newly created workspace and press **"Deploy DICOM Service"**:

3. After the DICOM service is deployed, visit the **"CORS headers"** section:

4. Set the headers and origins to `*` and specify the HTTP methods you'd like to use:

5. Save the changes.
6. Add the Microsoft emails of the users you'd like to grant access to your DICOM service in the **"Access control"** section and assign them the **"DICOM Data Owner"** role (or other roles depending on your requirements):

7. Copy your DICOM service URL to prepare it for usage in OHIF as a datasource:

8. Upload your DICOM files to your service.
---
## 1. Configure OIDC Authentication
Azure uses OpenID Connect (OIDC) for authentication. Update the OIDC section in your configuration file with the following parameters:
- **wadoUriRoot**: Base URL for WADO-URI requests.
- **wadoRoot**: Base URL for WADO-RS requests.
---
## 3. Running the Viewer with Azure Configuration
1. Save the above configurations in your OHIF Viewer configuration file.
2. Run the viewer:
```bash
cd OHIFViewer
yarn install
APP_CONFIG=config/azure.js yarn run dev
```
Replace `config/azure.js` with the path to your configuration file.
---
### Additional Notes
- Ensure that the Azure Healthcare API is enabled for your subscription and that the necessary permissions (e.g., `Dicom.ReadWrite`) are assigned to the OIDC client.
- The `qidoRoot`, `wadoUriRoot`, and `wadoRoot` should point to your Azure DICOM service URL. Replace `{your-dicom-instance}` with your actual instance name.
This setup allows OHIF to interact seamlessly with Azure's Healthcare APIs, enabling robust DICOM management and visualization.