# Vault administration (IRPCVaultAdmin)

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/

Administers the vault of the session: verify and repair, search indexes, archiving and restoring
from archives, and vault-level authentication settings.

Use this interface to verify the database and perform other administrative
tasks targeting the document vault.

- **gRPC service:** `MFiles.IRPCVaultAdmin`
- **Book and level:** [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md), specialized
- **Methods:** 21
- **Proto file:** [`mfiles/IRPCVaultAdmin.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCVaultAdmin.proto)

<a id="overview"></a>

## Overview

The vault-level maintenance commands of M-Files Admin; the M-Files API's vault management
operations also use [VerifyVault](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/VerifyVault/index.md). Use it from
administration tools and automation scripts. To create, back up, take offline or destroy whole
vaults, use [IRPCVaultsAdmin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/index.md) instead.

**Session and rights.** Every method works on the vault of the session, so it needs a vault
session; a server-level session fails with "Login required." (error code 0x80040043). The vault
rights (fields of `VaultAccess`) each method needs:

| Vault right | Methods |
| --- | --- |
| `verify_vault` | `VerifyVault`, `RebuildFullTextSearchIndexes`, `ExecuteIndexManagementOperation` |
| `verify_vault` | `CheckForIssue9855Errors`, `DismissIssue9855Errors`, `GetIssue9855ErrorDetails` |
| `see_all_objects` | `GetIndexOptions` |
| `archive` | `ArchiveDocuments`, `ArchiveOldVersions` |
| `restore_from_archive` | `RestoreFromArchive` |
| `archive` and `restore_from_archive` | `GetDefaultReplicationConfiguration` |
| `change_metadata_structure` and `license_allows_modifications` | `EnableAnnotationsAndRedlining` |
| Full control of the vault | The Entra ID and authentication configuration methods |
| None | `CheckAnnotationsAndRedlining` |

The vault role full control (and a system administrator's `full_control_of_vaults`) grants all of
them. A missing right fails with gRPC status `UNKNOWN`, "Access denied. You do not have the access
rights required by this operation." (error codes 0x800400A9 and 0x800407E4).

**Tasks:**

- **Check and repair the vault**: [VerifyVault](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/VerifyVault/index.md).
- **Search indexes**: [GetIndexOptions](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetIndexOptions/index.md),
  [ExecuteIndexManagementOperation](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ExecuteIndexManagementOperation/index.md),
  [RebuildFullTextSearchIndexes](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/RebuildFullTextSearchIndexes/index.md).
- **Archive and restore content**:
  [ArchiveDocuments](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveDocuments/index.md),
  [ArchiveOldVersions](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveOldVersions/index.md),
  [RestoreFromArchive](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/RestoreFromArchive/index.md),
  [GetDefaultReplicationConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetDefaultReplicationConfiguration/index.md).
  Each can first run as a preview (`preview_only`) that changes nothing.
- **Annotations**: [CheckAnnotationsAndRedlining](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/CheckAnnotationsAndRedlining/index.md),
  [EnableAnnotationsAndRedlining](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/EnableAnnotationsAndRedlining/index.md).
- **Microsoft Entra ID (Azure AD) authentication**: the `...AzureAD...` methods,
  [SetVaultVariables](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/SetVaultVariables/index.md) and the authentication
  configuration migration methods serve the vault properties of M-Files Admin. Several take
  binary input that only M-Files Admin produces.

**Background jobs.** `VerifyVault` (unless `synchronous`) and `ArchiveDocuments`,
`ArchiveOldVersions` and `RestoreFromArchive` (unless `preview_only`) create a temporary
scheduled job and return its ID in `task_id` before the work is done. Poll
[GetScheduledJobRunInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/GetScheduledJobRunInfo/index.md) with
`scheduled_job` = `task_id` until `is_running` is false and `current_step` is not -1 (-1 means
not started yet), then read `last_run_succeeded`, `last_run_errors` and `output`. Use the right
session, because server-level and vault-level jobs have separate IDs:

- A `VerifyVault` job is a server-level job: read it with a server-level session (log in with the
  null vault GUID). Reading a verification job needs no server right.
- Archive and restore jobs are jobs of the vault: read them with a session of the same vault and
  the vault right `archive`, `restore_from_archive` or `manage_scheduled_jobs`.

Cancel a running job with
[CancelScheduledJob](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/CancelScheduledJob/index.md).

<a id="methods"></a>

## Methods

| Method | Summary | Facts |
|---|---|---|
| [AddAutomaticAzureADConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/AddAutomaticAzureADConfiguration/index.md) | Creates the automatic Microsoft Entra ID (Azure AD) authentication configuration of the vault from a completed administrator consent sign-in. | `internal: not for applications` `admin` `session` `idempotent` |
| [ArchiveDocuments](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveDocuments/index.md) | Exports (archives) the objects that match a filter into an archive package, or previews how many would be archived. | `admin` `session` |
| [ArchiveOldVersions](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveOldVersions/index.md) | Archives old versions of documents that meet the job's conditions into an archive file on the server, or previews how many would be archived. | `admin` `session` |
| [CheckAnnotationsAndRedlining](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/CheckAnnotationsAndRedlining/index.md) | Checks whether the vault has the metadata structure that the annotations and redlining feature needs. | `admin` `session` `idempotent` |
| [CheckForIssue9855Errors](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/CheckForIssue9855Errors/index.md) | Gets the number of objects affected by a known file data problem of earlier M-Files versions that the server has detected in the vault, and that the administrator has not dismissed. | `admin` `session` `idempotent` |
| [ContainsAutomaticAzureADConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ContainsAutomaticAzureADConfiguration/index.md) | Checks whether the vault has an automatically created Microsoft Entra ID (Azure AD) authentication configuration. | `admin` `session` `idempotent` |
| [DeleteAutomaticAzureADConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/DeleteAutomaticAzureADConfiguration/index.md) | Deletes the automatically created Microsoft Entra ID (Azure AD) authentication configuration of the vault. | `admin` `session` `idempotent` |
| [DismissIssue9855Errors](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/DismissIssue9855Errors/index.md) | Marks the recorded file data problems of earlier M-Files versions as dismissed. | `admin` `session` |
| [EnableAnnotationsAndRedlining](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/EnableAnnotationsAndRedlining/index.md) | Enables annotations and redlining in the vault by creating the metadata structure elements that the feature needs. | `admin` `session` `idempotent` |
| [ExecuteIndexManagementOperation](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ExecuteIndexManagementOperation/index.md) | Runs a management operation on one search index of the vault: rebuild, re-index, activate, enable, disable or delete. | `admin` `session` |
| [GetAzureADProvisioningState](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetAzureADProvisioningState/index.md) | Gets whether user provisioning (SCIM) from Microsoft Entra ID (Azure AD) is enabled in the vault, and the license type of provisioned users. | `admin` `session` `idempotent` |
| [GetDefaultReplicationConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetDefaultReplicationConfiguration/index.md) | Gets the default cloud storage connection string for the vault's archive and replication jobs. | `admin` `session` `idempotent` |
| [GetIndexOptions](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetIndexOptions/index.md) | Lists the search indexes of the vault with their state and the management operations the caller may run on each. | `admin` `session` `idempotent` |
| [GetIssue9855ErrorDetails](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetIssue9855ErrorDetails/index.md) | Describes the recorded file data problems of earlier M-Files versions in the vault. | `admin` `session` `idempotent` |
| [GetMigrantAuthenticationConfigurations](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/GetMigrantAuthenticationConfigurations/index.md) | Lists the authentication configurations of the vault that need to be migrated to the current format. | `admin` `session` |
| [MigrateAuthenticationConfiguration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/MigrateAuthenticationConfiguration/index.md) | Migrates one authentication configuration of the vault to the current format after a successful test sign-in with it. | `internal: not for applications` `admin` `session` |
| [RebuildFullTextSearchIndexes](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/RebuildFullTextSearchIndexes/index.md) | Rebuilds the full-text search indexes of the vault: the metadata index, the file data index or both. | `admin` `session` `idempotent` |
| [RestoreFromArchive](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/RestoreFromArchive/index.md) | Imports the contents of an archive (or one object of it) into the vault, or previews the import. | `admin` `session` |
| [SetAzureADProvisioningState](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/SetAzureADProvisioningState/index.md) | Enables or disables user provisioning (SCIM) from Microsoft Entra ID (Azure AD) in the vault. | `admin` `session` `idempotent` |
| [SetVaultVariables](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/SetVaultVariables/index.md) | Sets the Microsoft Entra ID (Azure AD) consent mode of the vault. | `internal: not for applications` `admin` `session` `idempotent` |
| [VerifyVault](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/VerifyVault/index.md) | Verifies the consistency of a vault's database and optionally of its file data, and optionally fixes the problems it finds (M-Files Admin's "Verify and Repair"). | `admin` `session` |
