Register Resource Providers

br/innofactor:avm/ptn/management/register-providers:0.1.12

README

register-providers [Management/RegisterProviders]

Register Resource Providers

This module will register resource providers in a subscription based on the list provided.
A managed identity is created and granted privileges to run the registration process.

Usage Example

Simply add the following snippet to your Bicep file to use the module. The examples in this documentation will explore the various parameters available.

param resourceProvidersList array = [
  'Microsoft.Automation'
]

// Create a Resource Group which we will use to host the Identiies and Deployment Scripts
module resourceGroup 'br/public:avm/res/resources/resource-group:0.4.1' = {
  name: '${uniqueString(deployment().name, resourceLocation)}-registerProvidersRG'
  scope: subscription(subscriptionId)
  params: {
    location: resourceLocation
    name: resourceGroupName
    tags: {
      Role: 'Subscription configuration'
    }
  }
}

// Deploy the module to register the resource providers
module registerProviders 'br/innofactor:avm/ptn/management/register-providers' = {
  name: '${uniqueString(deployment().name, resourceLocation)}-registerProviders'
  params: {
    name: '${resourceGroup.outputs.name}-rp'
    location: resourceLocation
    subscriptionId: subscriptionId
    resourceProvidersList: resourceProvidersList
    deploymentResourceGroupName: resourceGroup.outputs.name
  }
}

Resource Types

Resource TypeAPI Version
Microsoft.Authorization/locks2020-05-01
Microsoft.Authorization/roleAssignments2022-04-01
Microsoft.ManagedIdentity/userAssignedIdentities2023-01-31
Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials2023-01-31
Microsoft.Resources/deploymentScripts2023-08-01

Usage examples

The following section provides usage examples for the module, which were used to validate and deploy the module successfully. For a full reference, please review the module’s test folder in its repository.

Note: Each example lists all the required parameters first, followed by the rest - each in alphabetical order.

Note: To reference the module, please use the following syntax br/innofactor:avm/ptn/management/register-providers:<version>.

Example 1: Using only defaults

Default Resister Resource Providers Test

Usage Example

Simply add the following snippet to your Bicep file to use the module. The examples in this documentation will explore the various parameters available.

module subscriptionConfiguration 'br/innofactor:avm/ptn/lz/subscription-configuration' = {
  name: 'subscriptionConfiguration'
  scope: managementGroup('myManagementGroup')
  params: {
    location: resourceLocation
    tags: {
      Environment: 'Production'
    }
    resourceProvidersList: ['Microsoft.Compute'']
    }
  }
}
via Bicep module
module registerProviders 'br/innofactor:avm/ptn/management/register-providers:<version>' = {
  name: 'registerProvidersDeployment'
  params: {
    location: '<location>'
    resourceProvidersList: '<resourceProvidersList>'
  }
}

via JSON parameters file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "value": "<location>"
    },
    "resourceProvidersList": {
      "value": "<resourceProvidersList>"
    }
  }
}

via Bicep parameters file
using 'br/innofactor:avm/ptn/management/register-providers:<version>'

param location = '<location>'
param resourceProvidersList = '<resourceProvidersList>'

Parameters

Conditional parameters

ParameterTypeDescription
managedIdentitiesobjectThe managed identity definition for this resource. Required if assignRbacRole is true and managedIdentityName is null.
managedIdentityNamestringName of the Managed Identity resource to create. Required if assignRbacRole is true and managedIdentities is null. Defaults to id-ContainerRegistryImport.

Optional parameters

ParameterTypeDescription
assignRbacRoleboolIf set, the Contributor role will be granted to the managed identity (passed by the managedIdentities parameter or create with the name specified in parameter managedIdentityName), which is needed to import images into the Azure Container Registry. Defaults to true.
cleanupPreferencestringWhen the script resource is cleaned up. Default is OnExpiration and the cleanup time is after 1h.
enableTelemetryboolEnable/Disable usage telemetry for module.
locationstringLocation for all Resources.
resourceProvidersListarrayAn object of resource providers and resource providers features to register. If left blank/empty, no resource providers will be registered.
runOnceboolHow the deployment script should be forced to execute. Default is to force the script to deploy the image to run every time.
tagsobjectTags of the resource.
Parameter: managedIdentities

The managed identity definition for this resource. Required if assignRbacRole is true and managedIdentityName is null.

  • Required: No
  • Type: object

Optional parameters

ParameterTypeDescription
userAssignedResourceIdsarrayThe resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption.
Parameter: managedIdentities.userAssignedResourceIds

The resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption.

  • Required: No
  • Type: array
Parameter: managedIdentityName

Name of the Managed Identity resource to create. Required if assignRbacRole is true and managedIdentities is null. Defaults to id-ContainerRegistryImport.

  • Required: No
  • Type: string
Parameter: assignRbacRole

If set, the Contributor role will be granted to the managed identity (passed by the managedIdentities parameter or create with the name specified in parameter managedIdentityName), which is needed to import images into the Azure Container Registry. Defaults to true.

  • Required: No
  • Type: bool
  • Default: True
Parameter: cleanupPreference

When the script resource is cleaned up. Default is OnExpiration and the cleanup time is after 1h.

  • Required: No
  • Type: string
  • Default: 'OnExpiration'
  • Allowed:
    [
      'Always'
      'OnExpiration'
      'OnSuccess'
    ]
Parameter: enableTelemetry

Enable/Disable usage telemetry for module.

  • Required: No
  • Type: bool
  • Default: True
Parameter: location

Location for all Resources.

  • Required: No
  • Type: string
  • Default: [resourceGroup().location]
Parameter: resourceProvidersList

An object of resource providers and resource providers features to register. If left blank/empty, no resource providers will be registered.

  • Required: No
  • Type: array
  • Default:
    [
      'Microsoft.Compute'
      'Microsoft.CostManagement'
      'Microsoft.KeyVault'
      'Microsoft.Storage'
      'Microsoft.Web'
    ]
Parameter: runOnce

How the deployment script should be forced to execute. Default is to force the script to deploy the image to run every time.

  • Required: No
  • Type: bool
  • Default: False
Parameter: tags

Tags of the resource.

  • Required: No
  • Type: object
  • Default: {}
  • Example:
    {
        "key1": "value1"
        "key2": "value2"
    }

Outputs

OutputTypeDescription
deploymentScriptLogsarrayOutput logs for the registration status.
deploymentScriptOutputobjectOutput Object for the registration status.
resourceGroupNamestringOutput name of the resource.

Cross-referenced modules

This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).

ReferenceType
br/innofactor:avm/ptn/management/register-providersRemote reference
br/public:avm/res/managed-identity/user-assigned-identity:0.4.0Remote reference
br/public:avm/res/resources/deployment-script:0.5.0Remote reference
br/public:avm/res/resources/resource-group:0.4.1Remote reference
br/public:avm/utl/types/avm-common-types:0.2.1Remote reference

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Changelog

Changelog

0.1.12

Changes
  • Regenerated main.json and README.md with Bicep 0.49.2 so that they match main.bicep (#206).
  • Released by the hardened pipeline: published only when main.json changes, release tag created after a successful publish, GitHub Release per tag (ADR 0004, ADR 0003, ADR 0005).
Breaking Changes
  • None

0.1.11

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.10

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.9

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.8

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.7

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.6

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.5

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.4

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.3

Changes
  • Dependency on Subscription Placement blocking publish (#116)
Breaking Changes
  • None

0.1.2

Changes
  • Name default value calculation (#113)
  • Subscription configuration resource and budgets (#110)
Breaking Changes
  • None

0.1.1

Changes
  • Republished without a change to the module. At the time the pipeline published a new patch version on every successful run, see ADR 0004.
Breaking Changes
  • None

0.1.0

Changes
  • 85 avm module issue register providers (#86)
  • Update main.bicep
  • Register-Providers telemetry location not needed (#84)
  • Add register-providers (#81)
Breaking Changes
  • None

Version history

VersionPublished
0.1.122026-11-16
0.1.112025-05-16
0.1.102025-05-01
0.1.92025-04-16
0.1.82025-04-01
0.1.72025-03-31
0.1.62025-03-16
0.1.52025-03-01
0.1.42025-02-16
0.1.32025-02-12
0.1.22025-02-12
0.1.12025-02-01
0.1.02025-01-31