Create and use managed identity for your Form Recognizer resource

Important

Azure role-based access control (Azure RBAC) assignment is currently in preview and not recommended for production workloads. Certain features may not be supported or have constrained capabilities. Azure RBAC assignments are used to grant permissions for managed identity.

What is managed identity?

Azure managed identity is a service principal that creates an Azure Active Directory (Azure AD) identity and specific permissions for Azure managed resources. You can use a managed identity to grant access to any resource that supports Azure AD authentication. To grant access, assign a role to a managed identity using Azure role-based access control (Azure RBAC). There is no added cost to use managed identity in Azure.

Managed identity supports both privately and publicly accessible Azure blob storage accounts. For storage accounts with public access, you can opt to use a shared access signature (SAS) to grant limited access. In this article, you'll learn to enable a system-assigned managed identity for your Form Recognizer instance.

Private storage account access

Note

Form Recognizer only supports system-assigned managed identities today. User-assigned managed identities is on the roadmap and will be enabled in the near future.

Private Azure storage account access and authentication is supported by managed identities for Azure resources. If you have an Azure storage account protected by a Virtual Network (VNet) or firewall or have enabled bring-your-own-storage (BYOS), Form Recognizer cannot directly access your storage account data; however, once a managed identity is enabled, the Form Recognizer service can access your storage account using an assigned managed identity credential.

Note

Prerequisites

To get started, you'll need:

Managed identity assignments

There are two types of managed identity: system-assigned and user-assigned. Currently, Form Recognizer is supported by system-assigned managed identity. A system-assigned managed identity is enabled directly on a service instance. It is not enabled by default; you have to go to your resource and update the identity setting. The system-assigned managed identity is tied to your resource throughout its lifecycle. If you delete your resource, the managed identity will be deleted as well.

In the following steps, we will enable a system-assigned managed identity and grant Form Recognizer limited access to your Azure blob storage account.

Enable a system-assigned managed identity

Important

To enable a system-assigned managed identity, you need Microsoft.Authorization/roleAssignments/write permissions, such as Owner or User Access Administrator. You can specify a scope at four levels: management group, subscription, resource group, or resource.

  1. Sign in to the Azure portal using an account associated with your Azure subscription.

  2. Navigate to your Form Recognizer resource page in the Azure portal.

  3. In the left rail, Select Identity from the Resource Management list:

    Screenshot: resource management identity tab in the Azure portal.

  4. In the main window, toggle the System assigned Status tab to On.

  5. Under Permissions select Azure role assignments:

    Screenshot: enable system-assigned managed identity in Azure portal.

  6. An Azure role assignments page will open. Choose your subscription from the drop-down menu then select + Add role assignment.

    Screenshot: Azure role assignments page in the Azure portal.

    Note

    If you're unable to assign a role in the Azure portal because the Add > Add role assignment option is disabled or you get the permissions error, "you do not have permissions to add role assignment at this scope", check that you're currently signed in as a user with an assigned a role that has Microsoft.Authorization/roleAssignments/write permissions such as Owner or User Access Administrator at the Storage scope for the storage resource.

  7. Next, you're going to assign a Storage Blob Data Reader role to your Form Recognizer service resource. In the Add role assignment pop-up window complete the fields as follows and select Save:

    Field Value
    Scope Storage
    Subscription The subscription associated with your storage resource.
    Resource The name of your storage resource
    Role Storage Blob Data Reader—allows for read access to Azure Storage blob containers and data.

    Screenshot: add role assignments page in the Azure portal.

  8. After you've received the Added Role assignment confirmation message, refresh the page to see the added role assignment.

    Screenshot: Added role assignment confirmation pop-up message.

  9. If you don't see the change right away, wait and try refreshing the page once more. When you assign or remove role assignments, it can take up to 30 minutes for changes to take effect.

    Screenshot: Azure role assignments window.

That's it! You have completed the steps to enable a system-assigned managed identity. With this identity credential, you can grant Form Recognizer specific access rights to documents and files stored in your BYOS account.

Learn more about managed identity