Policy Definitions - Create Or Update At Management Group

管理グループ内のポリシー定義を作成または更新します。
この操作により、指定された管理グループ内のポリシー定義が、指定された名前で作成または更新されます。

PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}?api-version=2023-04-01

URI パラメーター

名前 / 必須 説明
managementGroupId
path True

string

管理グループの ID。

policyDefinitionName
path True

string

作成するポリシー定義の名前。

Regex pattern: ^[^<>*%&:\?.+/]*[^<>*%&:\?.+/ ]+$

api-version
query True

string

この操作に使用する API バージョン。

要求本文

名前 説明
properties.description

string

ポリシー定義の説明。

properties.displayName

string

ポリシー定義の表示名。

properties.metadata

object

ポリシー定義メタデータ。 メタデータはオープンエンド オブジェクトであり、通常はキー値ペアのコレクションです。

properties.mode

string

ポリシー定義モード。 たとえば、All、Indexed、Microsoft.KeyVault.Data などです。

properties.parameters

<string,  ParameterDefinitionsValue>

ポリシー 規則で使用されるパラメーターのパラメーター定義。 キーはパラメーター名です。

properties.policyRule

object

ポリシールール。

properties.policyType

policyType

ポリシー定義の種類。 指定できる値は、NotSpecified、BuiltIn、Custom、Static です。

properties.version

string

#.#.# 形式のポリシー定義バージョン。

properties.versions

string[]

このポリシー定義で使用できるバージョンの一覧。

応答

名前 説明
201 Created

PolicyDefinition

作成済み - ポリシー定義に関する情報を返します。

Other Status Codes

CloudError

操作に失敗した理由を説明するエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名前 説明
user_impersonation ユーザー アカウントの借用

Create or update a policy definition at management group level

Sample Request

PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming?api-version=2023-04-01

{
  "properties": {
    "mode": "All",
    "displayName": "Enforce resource naming convention",
    "description": "Force resource names to begin with given 'prefix' and/or end with given 'suffix'",
    "metadata": {
      "category": "Naming"
    },
    "policyRule": {
      "if": {
        "not": {
          "field": "name",
          "like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
        }
      },
      "then": {
        "effect": "deny"
      }
    },
    "parameters": {
      "prefix": {
        "type": "String",
        "metadata": {
          "displayName": "Prefix",
          "description": "Resource name prefix"
        }
      },
      "suffix": {
        "type": "String",
        "metadata": {
          "displayName": "Suffix",
          "description": "Resource name suffix"
        }
      }
    }
  }
}

Sample Response

{
  "id": "/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "ResourceNaming",
  "properties": {
    "mode": "All",
    "displayName": "Naming Convention",
    "description": "Force resource names to begin with 'prefix' and end with 'suffix'",
    "metadata": {
      "category": "Naming"
    },
    "version": "1.2.1",
    "versions": [
      "1.2.1",
      "1.0.0"
    ],
    "policyRule": {
      "if": {
        "not": {
          "field": "name",
          "like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
        }
      },
      "then": {
        "effect": "deny"
      }
    },
    "parameters": {
      "prefix": {
        "type": "String",
        "metadata": {
          "displayName": "Prefix",
          "description": "Resource name prefix"
        }
      },
      "suffix": {
        "type": "String",
        "metadata": {
          "displayName": "Suffix",
          "description": "Resource name suffix"
        }
      }
    },
    "policyType": "Custom"
  }
}

定義

名前 説明
CloudError

ポリシー操作からのエラー応答。

createdByType

リソースを作成した ID の種類。

ErrorAdditionalInfo

リソース管理エラーの追加情報。

ErrorResponse

エラー応答

Metadata

パラメーターの一般的なメタデータ。

ParameterDefinitionsValue

ポリシーに提供できるパラメーターの定義。

parameterType

パラメーターのデータ型です。

PolicyDefinition

ポリシー定義。

policyType

ポリシー定義の種類。 指定できる値は、NotSpecified、BuiltIn、Custom、Static です。

systemData

リソースの作成と最後の変更に関連するメタデータ。

CloudError

ポリシー操作からのエラー応答。

名前 説明
error

ErrorResponse

エラー応答
失敗した操作のエラーの詳細を返す、すべての Azure Resource Manager API に対する一般的なエラー応答 (これは OData エラー応答形式にも従います)。

createdByType

リソースを作成した ID の種類。

名前 説明
Application

string

Key

string

ManagedIdentity

string

User

string

ErrorAdditionalInfo

リソース管理エラーの追加情報。

名前 説明
info

object

追加情報。

type

string

追加情報の種類。

ErrorResponse

エラー応答

名前 説明
additionalInfo

ErrorAdditionalInfo[]

エラーの追加情報。

code

string

エラー コード。

details

ErrorResponse[]

エラーの詳細です。

message

string

エラー メッセージ。

target

string

エラーのターゲット。

Metadata

パラメーターの一般的なメタデータ。

名前 説明
assignPermissions

boolean

ポリシーの割り当て中にこのパラメーターのリソース ID またはリソース スコープ値にロールの割り当てを作成Azure portal場合は true に設定します。 このプロパティは、割り当てスコープ外でアクセス許可を割り当てたい場合に便利です。

description

string

パラメーターの説明。

displayName

string

パラメーターの表示名。

strongType

string

ポータルを使用してポリシー定義を割り当てるときに使用されます。 ユーザーが選択する値のコンテキスト対応リストを提供します。

ParameterDefinitionsValue

ポリシーに提供できるパラメーターの定義。

名前 説明
allowedValues

object[]

パラメーターに使用できる値。

defaultValue

object

値が指定されていない場合のパラメーターの既定値。

metadata

Metadata

パラメーターの一般的なメタデータ。

schema

object

自己定義 JSON スキーマを使用した割り当て中のパラメーター入力の検証を提供します。 このプロパティは、オブジェクト型パラメーターでのみサポートされ、Json.NET Schema 2019-09 の実装に従います。 スキーマの使用については https://json-schema.org/ で、下書きスキーマのテストについては https://www.jsonschemavalidator.net/ で詳細を参照してください。

type

parameterType

パラメーターのデータ型です。

parameterType

パラメーターのデータ型です。

名前 説明
Array

string

Boolean

string

DateTime

string

Float

string

Integer

string

Object

string

String

string

PolicyDefinition

ポリシー定義。

名前 既定値 説明
id

string

ポリシー定義の ID。

name

string

ポリシー定義の名前。

properties.description

string

ポリシー定義の説明。

properties.displayName

string

ポリシー定義の表示名。

properties.metadata

object

ポリシー定義メタデータ。 メタデータはオープンエンド オブジェクトであり、通常はキー値ペアのコレクションです。

properties.mode

string

Indexed

ポリシー定義モード。 たとえば、All、Indexed、Microsoft.KeyVault.Data などです。

properties.parameters

<string,  ParameterDefinitionsValue>

ポリシー 規則で使用されるパラメーターのパラメーター定義。 キーはパラメーター名です。

properties.policyRule

object

ポリシールール。

properties.policyType

policyType

ポリシー定義の種類。 指定できる値は、NotSpecified、BuiltIn、Custom、Static です。

properties.version

string

#.#.# 形式のポリシー定義バージョン。

properties.versions

string[]

このポリシー定義で使用できるバージョンの一覧。

systemData

systemData

このリソースに関連するシステム メタデータ。

type

string

リソースの種類 (Microsoft.Authorization/policyDefinitions)。

policyType

ポリシー定義の種類。 指定できる値は、NotSpecified、BuiltIn、Custom、Static です。

名前 説明
BuiltIn

string

Custom

string

NotSpecified

string

Static

string

systemData

リソースの作成と最後の変更に関連するメタデータ。

名前 説明
createdAt

string

リソース作成のタイムスタンプ (UTC)。

createdBy

string

リソースを作成した ID。

createdByType

createdByType

リソースを作成した ID の種類。

lastModifiedAt

string

リソースの最終変更のタイムスタンプ (UTC)

lastModifiedBy

string

リソースを最後に変更した ID。

lastModifiedByType

createdByType

リソースを最後に変更した ID の種類。