Abrufen der untergeordneten Ressourcen einer Ressource, für die der Benutzer berechtigter Zugriff hat
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?api-version=2020-10-01
Mit optionalen Parametern:
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?$filter={$filter}&api-version=2020-10-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
scope
|
path |
True
|
string
|
Der Umfang der Rollenverwaltungsrichtlinie.
|
api-version
|
query |
True
|
string
minLength: 1
|
Die API-Version, die für diesen Vorgang verwendet werden soll.
|
$filter
|
query |
|
string
|
Der filter, der auf den Vorgang angewendet werden soll. Verwenden Sie $filter=resourceType+eq+'Subscription', um nur nach Der Ressource vom Typ = "Abonnement" zu filtern. Verwenden Sie $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup', um nach Ressource des Typs = 'Subscription' oder 'ResourceGroup' zu filtern.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
EligibleChildResourcesListResult
|
OK : Gibt Informationen zur Rollenverwaltungsrichtlinie zurück.
|
Other Status Codes
|
CloudError
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2-Fluss
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
GetEligibleChildResourcesByScope
Beispielanforderung
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Authorization.Models;
using Azure.ResourceManager.Authorization;
// Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json
// this example is just showing the usage of "EligibleChildResources_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// invoke the operation and iterate over the result
ResourceIdentifier scope = new ResourceIdentifier("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f");
string filter = "resourceType+eq+'resourcegroup'";
await foreach (EligibleChildResource item in client.GetEligibleChildResourcesAsync(scope, filter: filter))
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"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"
}
]
}
Definitionen
CloudError
Objekt
Eine Fehlerantwort des Diensts.
Name |
Typ |
Beschreibung |
error
|
CloudErrorBody
|
Eine Fehlerantwort des Diensts.
|
CloudErrorBody
Objekt
Eine Fehlerantwort des Diensts.
Name |
Typ |
Beschreibung |
code
|
string
|
Ein Bezeichner für den Fehler. Codes sind unveränderlich und sollen programmgesteuert genutzt werden.
|
message
|
string
|
Eine Meldung, die den Fehler beschreibt, der für die Anzeige in einer Benutzeroberfläche geeignet ist.
|
EligibleChildResource
Objekt
Berechtigte untergeordnete Ressource
Name |
Typ |
Beschreibung |
id
|
string
|
Die Ressourcenbereichs-ID.
|
name
|
string
|
Der Ressourcenname.
|
type
|
string
|
Der Ressourcentyp.
|
EligibleChildResourcesListResult
Objekt
Ergebnis des Listenvorgangs für berechtigte untergeordnete Ressourcen.
Name |
Typ |
Beschreibung |
nextLink
|
string
|
Die URL, die zum Abrufen des nächsten Resultsets verwendet werden soll.
|
value
|
EligibleChildResource[]
|
Berechtigte untergeordnete Ressourcenliste.
|