您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

用户Users

Azure Cosmos DB 是一种全球分布的多模型数据库,它支持文档、图形和键-值数据模型。Azure Cosmos DB is a globally distributed multi-model database that supports the document, graph, and key-value data models. 本部分中的内容适用于通过 REST 使用SQL API管理用户资源The content in this section is for managing user resources using the SQL API via REST.

用户是对集合、文档、附件、存储过程、触发器和用户定义函数划归权限作用域的逻辑命名空间。A user is a logical namespace for scoping permissions on collections, documents, attachment, stored procedures, triggers, and user-defined functions. 用户构造在数据库资源下生存,因此不能跨越它所在的数据库边界。The user construct lives under a database resource and thus cannot cross the database boundary it is under. 用户资源由 Azure Cosmos DB REST 资源模型中的用户表示。The user resource is represented by users in the Azure Cosmos DB REST resource model. 它是一个系统资源,因此包含固定的架构。It is a system resource, and thus contains a fixed schema.

以下示例显示一个用户的 JSON 表示形式示例:The following example shows an example JSON representation for a user:

{  
   "id":"JohnSmith@contoso.com",  
   "_rid":"rnYYACFnVAA=",  
   "_ts":1408056023,  
   "_self":"dbs\/rnYYAA==\/users\/rnYYACFnVAA=\/",  
   "_etag":"00004a00-0000-0000-0000-53ed3ad70000",  
   "_permissions":"permissions\/"  
}  
  
propertiesProperty 说明Description
idid 必需。Required. 它是唯一的用户可设置属性。It is the only user settable property. 它是标识用户的唯一名称,也就是说,在数据库中不会有两个用户共享同一 ID。It is a unique name that identifies a user, that is, no two users share the same ID within a database. 该名称不得超过 255 个字符。The name must not exceed 255 characters.
_rid_rid 它是系统生成的属性。It is a system generated property. 资源 ID (_rid) 是一个唯一标识符,也是按照资源模型上的资源堆栈进行分层的。The resource ID (_rid) is a unique identifier that is also hierarchical per the resource stack on the resource model. 它可供内部用于放置和导航用户资源。It is used internally for placement and navigation of the user resource.
_ts_ts 它是系统生成的属性。It is a system generated property. 它指定资源的上次更新时间戳。It specifies the last updated timestamp of the resource. 高值是一个时间戳。The value is a timestamp.
_self_self 它是系统生成的属性。It is a system generated property. 它是资源的唯一可寻址 URI。It is the unique addressable URI for the resource.
_etag_etag 它是系统生成的属性,表示乐观并发控制所需的资源 etag。It is a system generated property representing the resource etag required for optimistic concurrency control.
_permissions_permissions 它是系统生成的属性,表示权限资源的源的可寻址路径。It is a system generated property denoting the addressable path of the feed of permissions resource.

任务Tasks

你可以对用户执行以下操作:You can do the following with users:

另请参阅See Also