> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/automation/runbooks/runbook-references/org/general/office365-license-report.md).

# Office365 License Report

Report Microsoft 365 license usage and availability

### Description

Creates a report of the Microsoft 365 licenses in the tenant, how many are in use and how many are free. Exchange Online details such as shared mailbox licensing can be added. The report files can be uploaded to an Azure Storage account, as single files or as one ZIP, with download links. Nothing is changed unless real user data is requested, which briefly switches off the report privacy setting and restores it afterwards.

### Configure the storage account for the export

The report files are uploaded to an Azure Storage account. Its subscription, resource group and name come from the tenant settings below; the container name is taken from `OfficeLicensingReport.Container`. The switches of this runbook are backed by `OfficeLicensingReport.*` settings as well, so their defaults can be fixed per tenant.

```json
{
	"Settings": {
		"OfficeLicensingReport": {
			"ResourceGroup": "rj-test-runbooks-01",
			"SubscriptionId": "00000000-0000-0000-0000-000000000000",
			"StorageAccount": {
				"Name": "rbexports01"
			}
		}
	}
}
```

For more information on how to customize runbooks, please refer to the [Runbook Customization Guide](https://docs.realmjoin.com/automation/runbooks/runbook-customization).

### Location

Organization → General → Office365 License Report

**Full Runbook name**

rjgit-org\_general\_office365-license-report

### Details

| Property         | Value                                                                                                       |
| ---------------- | ----------------------------------------------------------------------------------------------------------- |
| Version          | 1.1.3                                                                                                       |
| Required modules | <p>RealmJoin.RunbookHelper (>= 0.8.10)<br>Az.Accounts (>= 5.5.2)<br>ExchangeOnlineManagement (>= 3.9.2)</p> |
| Schedulable      | no                                                                                                          |

### Permissions

#### Application permissions

* **Type**: Microsoft Graph
  * Reports.Read.All
    * *Pulls the Office 365 usage and activity report CSVs from /reports*
  * Directory.Read.All
    * *Reads /subscribedSkus and group license assignments for the SKU overview*
  * User.Read.All
    * *Lists users and reads their license details for the per-user reports*
  * ReportSettings.ReadWrite.All
    * *Temporarily disables concealed report names when includeUserData is enabled, then restores the setting*
  * AuditLog.Read.All *(optional — feature: Sign-in export)*
    * *Reads /auditLogs/signIns for the per-application sign-in export when exportToFile is enabled (default on)*
* **Type**: Office 365 Exchange Online
  * Exchange.ManageAsApp *(optional — feature: Exchange licensing report)*
    * *Runs Get-EXOMailbox for the shared mailbox licensing report when includeExchange is enabled*

#### RBAC roles

* Exchange Administrator
  * *Required for the app-only Exchange Online session when includeExchange is enabled*

### Parameters

#### printOverview

Prints a table per license SKU with total, used, available and suspended counts in the run output.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | True    |
| Type          | Boolean |

#### includeExchange

Adds Exchange Online reports such as shared mailbox licensing.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | False   |
| Type          | Boolean |

#### includeUserData

Shows real user names in the activity reports by switching off the report privacy setting for the run; it is restored afterwards. The reports then contain personal data, so check your data protection rules first.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | False   |
| Type          | Boolean |

#### exportToFile

Uploads the report files to the Azure Storage account configured in the tenant settings.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | True    |
| Type          | Boolean |

#### exportAsZip

Uploads one ZIP file instead of the single report files.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | False   |
| Type          | Boolean |

#### produceLinks

Returns time-limited download links for the uploaded files.

| Property      | Value   |
| ------------- | ------- |
| Required      | false   |
| Default Value | True    |
| Type          | Boolean |

#### ContainerName

Storage container the report files are uploaded to. Taken from the tenant setting OfficeLicensingReport.Container.

| Property      | Value                    |
| ------------- | ------------------------ |
| Required      | false                    |
| Default Value | rjrb-licensing-report-v2 |
| Type          | String                   |

#### ResourceGroupName

Resource group of the storage account. Taken from the tenant setting OfficeLicensingReport.ResourceGroup.

| Property      | Value  |
| ------------- | ------ |
| Required      | false  |
| Default Value |        |
| Type          | String |

#### StorageAccountName

Storage account for the export. Taken from the tenant setting OfficeLicensingReport.StorageAccount.Name.

| Property      | Value  |
| ------------- | ------ |
| Required      | false  |
| Default Value |        |
| Type          | String |

#### SubscriptionId

Azure subscription that holds the storage account. Taken from the tenant setting OfficeLicensingReport.SubscriptionId.

| Property      | Value  |
| ------------- | ------ |
| Required      | false  |
| Default Value |        |
| Type          | String |

[Back to Runbook Reference overview](/automation/runbooks/runbook-references.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmjoin.com/automation/runbooks/runbook-references/org/general/office365-license-report.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
