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

Resources - List

获取订阅中的所有资源。

GET https://management.azure.com/subscriptions/{subscriptionId}/resources?api-version=2021-04-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resources?$filter={$filter}&$expand={$expand}&$top={$top}&api-version=2021-04-01

URI 参数

名称 必需 类型 说明
subscriptionId
path True

string

Microsoft Azure 订阅 ID。

api-version
query True

string

要用于此操作的 API 版本。

$expand
query

string

要包含在响应中的其他属性的逗号分隔列表。 有效值包括 createdTimechangedTimeprovisioningState。 例如 $expand=createdTime,changedTime

$filter
query

string

要应用于操作的筛选器。

筛选器比较运算符包括 eq (等于) ,ne (不等于) ,可以与以下属性一起使用:location、、resourceTypenameresourceGroupidentityidentity/principalId、、planplan/productplan/nameplan/publisherplan/version和 。plan/promotionCode

例如,若要按资源类型筛选,请使用 $filter=resourceType eq 'Microsoft.Network/virtualNetworks'


substringof(value, property) 可用于筛选以下当前支持的属性的子字符串: nameresourceGroup

例如,若要在资源名称的任意位置获取具有“demo”的所有资源,请使用 $filter=substringof('demo', name)

还可以使用 and/or 运算符组合多个子字符串操作。

请注意,使用筛选器时,通过 $top 查询的任何截断结果数也可能不兼容。


可以按标记名称和值筛选资源。 例如,若要筛选标记名称和值,请使用 $filter=tagName eq 'tag1' and tagValue eq 'Value1'。 请注意,按标记名称和值筛选资源时, 结果中不会返回每个资源的原始标记。 按标记名称/值进行筛选时,通过 $expand 查询的任何其他属性列表也可能不兼容。

仅对于标记名称,可以使用以下语法按前缀筛选资源: $filter=startswith(tagName, 'depart')。 此查询将返回标记名称以短语 depart (即departmentdepartureDatedepartureTimeetc.)


请注意,筛选资源时,可以组合某些属性,其中包括: substringof() and/or resourceTypeplan and plan/publisher and plan/nameidentity and identity/principalId

$top
query

integer

int32

如果使用此 API 的分页版本,则每页的建议数。

响应

名称 类型 说明
200 OK

ResourceListResult

OK - 返回资源数组。

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 模拟用户帐户

定义

名称 说明
CloudError

资源管理请求的错误响应。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorResponse

错误响应

ExtendedLocation

资源扩展位置。

ExtendedLocationType

扩展位置类型。

GenericResourceExpanded

资源信息。

Identity

资源的标识。

Plan

资源计划。

ResourceIdentityType

标识类型。

ResourceListResult

资源组列表。

Sku

资源的 SKU。

UserAssignedIdentities

与资源关联的用户标识列表。 用户标识字典密钥引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

CloudError

资源管理请求的错误响应。

名称 类型 说明
error

ErrorResponse

错误响应
对所有 Azure 资源管理器 API 的常见错误响应,可返回失败操作的错误详细信息。 (这也遵循 OData 错误响应格式。)

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorResponse

错误响应

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorResponse[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ExtendedLocation

资源扩展位置。

名称 类型 说明
name

string

扩展位置名称。

type

ExtendedLocationType

扩展位置类型。

ExtendedLocationType

扩展位置类型。

名称 类型 说明
EdgeZone

string

GenericResourceExpanded

资源信息。

名称 类型 说明
changedTime

string

资源的更改时间。 仅当通过 $expand 查询参数请求时才存在。

createdTime

string

资源的创建时间。 仅当通过 $expand 查询参数请求时才存在。

extendedLocation

ExtendedLocation

资源扩展位置。

id

string

资源 ID

identity

Identity

资源的标识。

kind

string

资源的种类。

location

string

资源位置

managedBy

string

管理此资源的资源的 ID。

name

string

资源名称

plan

Plan

资源的计划。

properties

object

资源属性。

provisioningState

string

资源的预配状态。 仅当通过 $expand 查询参数请求时才存在。

sku

Sku

资源的 SKU。

tags

object

资源标记

type

string

资源类型

Identity

资源的标识。

名称 类型 说明
principalId

string

资源标识的主体 ID。

tenantId

string

资源的租户 ID。

type

ResourceIdentityType

标识类型。

userAssignedIdentities

UserAssignedIdentities

与资源关联的用户标识列表。 用户标识字典密钥引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

Plan

资源计划。

名称 类型 说明
name

string

计划 ID。

product

string

产品/服务 ID。

promotionCode

string

促销代码。

publisher

string

发布者 ID。

version

string

计划的版本。

ResourceIdentityType

标识类型。

名称 类型 说明
None

string

SystemAssigned

string

SystemAssigned, UserAssigned

string

UserAssigned

string

ResourceListResult

资源组列表。

名称 类型 说明
nextLink

string

用于获取下一组结果的 URL。

value

GenericResourceExpanded[]

资源数组。

Sku

资源的 SKU。

名称 类型 说明
capacity

integer

SKU 容量。

family

string

SKU 系列。

model

string

SKU 模型。

name

string

SKU 名称。

size

string

SKU 大小。

tier

string

SKU 层。

UserAssignedIdentities

与资源关联的用户标识列表。 用户标识字典密钥引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

名称 类型 说明