取得使用者具有合格存取權的資源子資源
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?api-version=2020-10-01
含選擇性參數:
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?$filter={$filter}&api-version=2020-10-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
scope
|
path |
True
|
string
|
角色管理原則的範圍。
|
api-version
|
query |
True
|
string
|
用於此作業的 API 版本。
|
$filter
|
query |
|
string
|
要套用至作業的篩選條件。 使用 $filter=resourceType+eq+'Subscription' 只篩選類型 = 'Subscription' 的資源。 使用 $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' 來篩選類型 = 'Subscription' 或 'ResourceGroup' 的資源
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
GetEligibleChildResourcesByScope
範例要求
GET https://management.azure.com/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/eligibleChildResources?$filter=resourceType+eq+'resourcegroup'&api-version=2020-10-01
/**
* Samples for EligibleChildResources Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/
* GetEligibleChildResourcesByScope.json
*/
/**
* Sample code: GetEligibleChildResourcesByScope.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getEligibleChildResourcesByScope(com.azure.resourcemanager.AzureResourceManager azure) {
azure.accessManagement().roleAssignments().manager().roleServiceClient().getEligibleChildResources().get(
"providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f",
"resourceType eq 'resourcegroup'", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armauthorization_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json
func ExampleEligibleChildResourcesClient_NewGetPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armauthorization.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewEligibleChildResourcesClient().NewGetPager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.EligibleChildResourcesClientGetOptions{Filter: to.Ptr("resourceType+eq+'resourcegroup'")})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.EligibleChildResourcesListResult = armauthorization.EligibleChildResourcesListResult{
// Value: []*armauthorization.EligibleChildResource{
// {
// Name: to.Ptr("RG-1"),
// Type: to.Ptr("resourcegroup"),
// ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-1"),
// },
// {
// Name: to.Ptr("RG-2"),
// Type: to.Ptr("resourcegroup"),
// ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-2"),
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AuthorizationManagementClient } = require("@azure/arm-authorization");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Get the child resources of a resource on which user has eligible access
*
* @summary Get the child resources of a resource on which user has eligible access
* x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json
*/
async function getEligibleChildResourcesByScope() {
const subscriptionId =
process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f";
const filter = "resourceType+eq+'resourcegroup'";
const options = { filter };
const credential = new DefaultAzureCredential();
const client = new AuthorizationManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.eligibleChildResources.list(scope, options)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"value": [
{
"name": "RG-1",
"id": "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-1",
"type": "resourcegroup"
},
{
"name": "RG-2",
"id": "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-2",
"type": "resourcegroup"
}
]
}
定義
CloudError
來自服務的錯誤回應。
CloudErrorBody
來自服務的錯誤回應。
名稱 |
類型 |
Description |
code
|
string
|
錯誤的識別碼。 程式碼不變,且要以程式設計方式使用。
|
message
|
string
|
描述錯誤的訊息,適用於在使用者介面中顯示。
|
EligibleChildResource
合格的子資源
名稱 |
類型 |
Description |
id
|
string
|
資源範圍標識碼。
|
name
|
string
|
資源名稱。
|
type
|
string
|
資源類型。
|
EligibleChildResourcesListResult
合格的子資源清單作業結果。