跳到主要内容

Azure Resource Providerの登録

Azure Resource Provider(リソースプロバイダー)は、Azureのリソースタイプを提供するサービスです。特定のAzureサービスを使用するには、そのサービスに対応するResource Providerをサブスクリプションに登録する必要があります。

Resource Providerとは

Resource Providerは、Azureリソースの作成、管理、削除などの操作を処理する名前空間です。各Azureサービスは1つ以上のResource Providerを持ち、以下のような命名規則に従います。

  • 形式: Microsoft.<ServiceName>
  • :
    • Microsoft.Compute - 仮想マシン、仮想マシンスケールセットなど
    • Microsoft.Storage - ストレージアカウント
    • Microsoft.Web - App Service、Functions
    • Microsoft.Network - 仮想ネットワーク、ロードバランサー
    • Microsoft.Sql - Azure SQL Database

主要なResource Provider

Kubernetesとコンテナ関連

Microsoft.ContainerService

Azure Kubernetes Service (AKS) のクラスターリソースを提供します。

Microsoft.KubernetesConfiguration

AKSクラスターに対するGitOps、Flux、その他の構成管理機能を提供します。AKSの拡張機能や構成管理を使用する場合に必要です。

# 登録例
az provider register --namespace Microsoft.KubernetesConfiguration

Microsoft.ServiceNetworking

AKS向けのアプリケーションロードバランシング機能やサービスメッシュ機能を提供します。Application Gateway for Containersなどの高度なネットワーキング機能を使用する際に必要です。

# 登録例
az provider register --namespace Microsoft.ServiceNetworking

その他の重要なProvider

Microsoft.OperationalInsights

Azure Monitor Log Analytics ワークスペースを提供します。コンテナインサイトや各種監視機能で使用されます。

Microsoft.AlertsManagement

Azure Monitorのアラート管理機能を提供します。

Microsoft.Insights

Application Insightsやメトリクス収集などの監視・診断機能を提供します。

Resource Providerの登録方法

Azure Portal

  1. Azure Portalで対象のサブスクリプションに移動
  2. 左メニューから「リソースプロバイダー」を選択
  3. 登録したいProviderを検索
  4. 「登録」ボタンをクリック

登録には数分かかる場合があります。ステータスが「Registered」になれば完了です。

Azure CLI

# Resource Providerの登録
az provider register --namespace <ProviderNamespace>

# 登録状態の確認
az provider show --namespace <ProviderNamespace> --query "registrationState"

# すべてのProviderの一覧と状態を表示
az provider list --query "[].{Provider:namespace, Status:registrationState}" --output table

実行例

# Microsoft.ServiceNetworkingを登録
az provider register --namespace Microsoft.ServiceNetworking

# 登録状態を確認
az provider show --namespace Microsoft.ServiceNetworking --query "registrationState"
# 出力: "Registered"

Azure PowerShell

# Resource Providerの登録
Register-AzResourceProvider -ProviderNamespace <ProviderNamespace>

# 登録状態の確認
Get-AzResourceProvider -ProviderNamespace <ProviderNamespace>

# すべてのProviderの一覧と状態を表示
Get-AzResourceProvider | Select-Object ProviderNamespace, RegistrationState

Terraform

resource "azurerm_resource_provider_registration" "example" {
name = "Microsoft.ServiceNetworking"
}

ARM Template / Bicep

resource servicenetworking 'Microsoft.Resources/providers@2021-04-01' = {
name: 'Microsoft.ServiceNetworking'
}

登録が必要なタイミング

以下のような場合に、Resource Providerの登録が必要になります。

  1. 新しいサービスを初めて使用する時

    • サブスクリプションで初めてAKSを作成する際に Microsoft.ContainerService が必要
  2. 拡張機能を使用する時

    • AKSでGitOpsを使用する際に Microsoft.KubernetesConfiguration が必要
    • Application Gateway for Containersを使用する際に Microsoft.ServiceNetworking が必要
  3. プレビュー機能を使用する時

    • 新しいプレビュー機能では、専用のResource Providerが必要な場合がある

注意点とベストプラクティス

権限要件

Resource Providerの登録には、以下のいずれかの権限が必要です。

  • サブスクリプションの Owner ロール
  • サブスクリプションの Contributor ロール
  • カスタムロールで Microsoft.Resources/subscriptions/resourceProviders/register/action 権限

自動登録

一部のAzureサービスでは、リソースの作成時に必要なResource Providerが自動的に登録されます。ただし、以下の理由から事前登録を推奨します。

  • デプロイ時間の短縮: 自動登録には時間がかかる場合がある
  • エラーの回避: 権限不足による登録失敗を事前に検出できる
  • Infrastructure as Code: TerraformやBicepでの明示的な依存関係管理

Terraformでの依存関係管理

# Resource Providerの登録
resource "azurerm_resource_provider_registration" "servicenetworking" {
name = "Microsoft.ServiceNetworking"
}

# Resource Providerに依存するリソース
resource "azurerm_kubernetes_cluster" "example" {
# ... 他の設定 ...

depends_on = [
azurerm_resource_provider_registration.servicenetworking
]
}

よくあるエラー

エラーメッセージ例

The subscription is not registered to use namespace 'Microsoft.ServiceNetworking'.
See https://aka.ms/rps-not-found for how to register subscriptions.

このエラーが発生した場合は、該当するResource Providerを登録してください。

Resource Providerの一覧確認

頻繁に使用されるProvider

Namespaceサービス
Microsoft.ComputeVirtual Machines, VM Scale Sets
Microsoft.NetworkVirtual Network, Load Balancer, Application Gateway
Microsoft.StorageStorage Accounts
Microsoft.WebApp Service, Functions
Microsoft.SqlSQL Database, SQL Managed Instance
Microsoft.ContainerServiceAzure Kubernetes Service
Microsoft.ContainerRegistryAzure Container Registry
Microsoft.KeyVaultKey Vault
Microsoft.OperationalInsightsLog Analytics
Microsoft.InsightsApplication Insights, Monitoring

すべての利用可能なProviderを確認

# Azure CLIで全Provider一覧を取得
az provider list --output table

# 特定のキーワードで検索(例: Kubernetes関連)
az provider list --query "[?contains(namespace,'Kubernetes')]" --output table

まとめ

  • Resource Providerは、Azureサービスを使用するための登録が必要なサービス名前空間
  • Microsoft.<ServiceName> の命名規則に従う
  • Azure Portal、CLI、PowerShell、IaCツールで登録可能
  • 適切な権限(Owner/Contributor)が必要
  • Infrastructure as Codeでは明示的に依存関係を管理することを推奨

関連リンク