你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

User Assigned Identities - Create Or Update

在指定的订阅和资源组中创建或更新标识。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}?api-version=2024-11-30

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

标识所属的资源组的名称。

resourceName
path True

string

标识资源的名称。

subscriptionId
path True

string

标识所属的订阅的 ID。

api-version
query True

string

要调用的 API 版本。

请求正文

名称 必需 类型 说明
location True

string

资源所在的地理位置

properties.isolationScope

isolationScope

根据需要配置标识分配的区域限制的枚举。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

Identity

更新的标识

201 Created

Identity

已创建标识

Other Status Codes

CloudError

描述操作失败的原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

IdentityCreate

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/resourceName?api-version=2024-11-30

{
  "location": "eastus",
  "tags": {
    "key1": "value1",
    "key2": "value2"
  }
}

示例响应

{
  "id": "/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
  "location": "eastus",
  "name": "identityName",
  "properties": {
    "clientId": "4024ab25-56a8-4370-aea6-6389221caf29",
    "principalId": "25cc773c-7f05-40fc-a104-32d2300754ad",
    "tenantId": "b6c948ef-f6b5-4384-8354-da3a15eca969",
    "isolationScope": "None"
  },
  "tags": {
    "key1": "value1",
    "key2": "value2"
  },
  "type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}
{
  "id": "/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
  "location": "eastus",
  "name": "identityName",
  "properties": {
    "clientId": "4024ab25-56a8-4370-aea6-6389221caf29",
    "principalId": "25cc773c-7f05-40fc-a104-32d2300754ad",
    "tenantId": "b6c948ef-f6b5-4384-8354-da3a15eca969",
    "isolationScope": "None"
  },
  "tags": {
    "key1": "value1",
    "key2": "value2"
  },
  "type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}

定义

名称 说明
CloudError

ManagedServiceIdentity 服务的错误响应。

CloudErrorBody

ManagedServiceIdentity 服务的错误响应。

createdByType

创建资源的标识的类型。

Identity

描述标识资源。

isolationScope

根据需要配置标识分配的区域限制的枚举。

systemData

与创建和上次修改资源相关的元数据。

CloudError

ManagedServiceIdentity 服务的错误响应。

名称 类型 说明
error

CloudErrorBody

有关错误的其他详细信息的列表。

CloudErrorBody

ManagedServiceIdentity 服务的错误响应。

名称 类型 说明
code

string

错误的标识符。

details

CloudErrorBody[]

有关错误的其他详细信息的列表。

message

string

描述错误的消息,旨在适合在用户界面中显示。

target

string

特定错误的目标。 例如,错误属性的名称。

createdByType

创建资源的标识的类型。

名称 类型 说明
Application

string

Key

string

ManagedIdentity

string

User

string

Identity

描述标识资源。

名称 类型 说明
id

string

资源的完全限定资源 ID。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”

location

string

资源所在的地理位置

name

string

资源的名称

properties.clientId

string

与标识关联的应用的 ID。 这是 MSI 随机生成的 UUID。

properties.isolationScope

isolationScope

根据需要配置标识分配的区域限制的枚举。

properties.principalId

string

与创建的标识关联的服务主体对象的 ID。

properties.tenantId

string

标识所属的租户的 ID。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

tags

object

资源标记。

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

isolationScope

根据需要配置标识分配的区域限制的枚举。

名称 类型 说明
None

string

Regional

string

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。