azureterraformazure-app-configuration

Unable to register Microsoft.AppConfiguration in the 12-month free subscription


I got a 12-month free subscription which includes $200 credit. I'm unable to register Microsoft.AppConfiguration. Is it not included in the free subscription? https://azure.microsoft.com/en-us/pricing/free-services

Error: creating Configuration Store (Subscription: "d06b4e1f-4bcd-40ea-87c4-c1ecf574a2df" │ Resource Group Name: "pr-euw-terraform-rg" │ Configuration Store Name: "pr-euw-appconfiguration"): performing Create: Put "https://management.azure.com/subscriptions/d06b4e1f-4bcd-40ea-87c4-c1ecf574a2df/resourceGroups/pr-euw-terraform-rg/providers/Microsoft.AppConfiguration/configurationStores/pr-euw-appconfiguration?api-version=2023-03-01": The Resource Provider was not registered │ │ Resource Providers (APIs) in Azure need to be registered before they can be used - however the Resource │ Provider was not registered, and calling the API returned the following error: │ │ The subscription is not registered to use namespace 'Microsoft.AppConfiguration'. See https://aka.ms/rps-not-found for how to register subscriptions. > │ │ The Azure Provider by default will automatically register certain Resource Providers at launch-time, │ whilst it's possible to opt-out of this (which you may have done) │ │ Please ensure that this Resource Provider is properly registered, you can do this using the Azure CLI │ for example to register the Resource Provider "Some.ResourceProvider" is registered run: │ │ > az provider register --namespace "Some.ResourceProvider" │ │ Resource Providers can take a while to register, you can check the status by running: │ │ > az provider show --namespace "Some.ResourceProvider" --query "registrationState" │ │ Once this outputs "Registered" the Resource Provider is available for use and you can re-run Terraform. │ │ │ with azurerm_app_configuration.appconfiguration, │ on main.tf line 79, in resource "azurerm_app_configuration" "appconfiguration": │ 79: resource "azurerm_app_configuration" "appconfiguration" {

# Key Vault
data "azurerm_client_config" "current" {}

resource "azurerm_key_vault" "kv" {
  name                        = "${var.name_prefix}-kv"
  location                    = azurerm_resource_group.rg.location
  resource_group_name         = azurerm_resource_group.rg.name
  enabled_for_disk_encryption = true
  tenant_id                   = data.azurerm_client_config.current.tenant_id
  soft_delete_retention_days  = 7
  purge_protection_enabled    = true

  sku_name = "standard"

  access_policy {
    tenant_id          = data.azurerm_client_config.current.tenant_id
    object_id          = data.azurerm_client_config.current.object_id

    key_permissions    = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"]
    secret_permissions = ["Get", "Set"]
  }
}

output "tenant_id" {
    value = data.azurerm_client_config.current.tenant_id
}

output "object_id" {
    value = data.azurerm_client_config.current.object_id
}

resource "azurerm_key_vault_secret" "ai_connection_string" {
  name         = "ApplicationInsightsConnectionString"
  value        = "InstrumentationKey=${azurerm_application_insights.ai.instrumentation_key};IngestionEndpoint=https://westeurope-4.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/"
  key_vault_id = azurerm_key_vault.kv.id
}

# Azure App Configuration
resource "azurerm_app_configuration" "appconfiguration" {
  name                = "${var.name_prefix}-appconfiguration"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  sku                 = "standard"
}

resource "azurerm_app_configuration_key" "ai_connection_string" {
  configuration_store_id = azurerm_app_configuration.appconfiguration.id
  key                    = "ApplicationInsights:ConnectionString"
  value                  = "@Microsoft.KeyVault(SecretUri=${azurerm_key_vault_secret.ai_connection_string.id})"
}

Solution

  • If you look at the error message, you will see the following:

    The Resource Provider was not registered │ │ Resource Providers (APIs) in Azure need to be registered before they can be used - however the Resource │ Provider was not registered, and calling the API returned the following error: │ │ The subscription is not registered to use namespace 'Microsoft.AppConfiguration'

    Before you can create an App Configuration resource in an Azure Subscription, that Subscription must be registered to with Microsoft.AppConfiguration resource provider.

    Please see this link for instructions on how to register a Subscription with a resource provider: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types.

    Once that is done successfully, you should not get the error you are getting.