Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can deploy Microsoft Graph resources using Bicep templates even if your tenant doesn't have an Azure subscription. This article explains how to deploy at the tenant scope, so you can automate Microsoft Graph resource deployment without Azure. This approach is useful when:
- Your organization doesn't use Azure services.
- You have an Azure AD B2C tenant that can't support Azure subscriptions.
- You have a Microsoft Entra external tenant that can't support Azure subscriptions.
Note
This method applies only if your Bicep template contains Microsoft Graph resources exclusively. If your template includes Azure resources, you need a valid Azure subscription.
Prerequisites
- The tenant doesn't have any Azure subscriptions.
- The user and/or service principal deploying the Bicep file must have the minimum permissions required for the resources in the Bicep file.
- Install Bicep tools for authoring and deployment. This article uses Visual Studio Code with the Bicep extension for authoring and Azure CLI for deployment. Azure PowerShell examples are also provided.
- You can deploy Bicep files interactively or using app-only (zero-touch) deployment.
Deploy Microsoft Graph resources
Follow these steps to deploy Microsoft Graph resources at the tenant scope without an Azure subscription.
Assign deployment permissions to the principal:
- Elevate account access to the User Access Administrator role if needed.
- Assign deployment permissions to the user or service principal at the tenant (
/) scope. Use one of the following methods, listed from least to most privileged:- Assign a custom role with the
Microsoft.Resources/deployments/*permission. - Assign a built-in Azure DevOps role with the
Microsoft.Resources/deployments/*permission. - Assign the Owner or Contributor role.
- Assign a custom role with the
In the following request, <principalId> is the ID of the user (in interactive deployments) or service principal (in app-only deployments) deploying the resources; <principalType> is "user" or "servicePrincipal" for interactive or app-only deployments respectively.
az role assignment create --assignee-object-id "<principalId>" --assignee-principal-type "<principalType>" --scope "/" --role "Owner"`- Remove the elevated access assignment when you're done.
Set the deployment scope in your Bicep file:
- In your
main.bicepfile, addtargetScope = 'tenant'at the top. The template must contain only Microsoft Graph resources.
- In your
Deploy at the tenant scope using the security principal with deployment privileges. Use az deployment tenant create or New-AzTenantDeployment:
az deployment tenant create --location WestUS --template-file main.bicep