Získání podřízených prostředků prostředku, ke kterému má uživatel oprávněný přístup
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?api-version=2020-10-01
S volitelnými parametry:
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/eligibleChildResources?$filter={$filter}&api-version=2020-10-01
Parametry identifikátoru URI
Name |
V |
Vyžadováno |
Typ |
Description |
scope
|
path |
True
|
string
|
Rozsah zásad správy rolí.
|
api-version
|
query |
True
|
string
minLength: 1
|
Verze rozhraní API, která se má použít pro tuto operaci.
|
$filter
|
query |
|
string
|
Filtr, který se má použít pro operaci. Pomocí $filter=resourceType+eq+'Subscription' vyfiltrujte pouze prostředek typu = Subscription. Pomocí $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' vyfiltrujte prostředek typu = Subscription nebo ResourceGroup.
|
Odpovědi
Zabezpečení
azure_auth
Azure Active Directory OAuth2 Flow
Typ:
oauth2
Tok:
implicit
URL autorizace:
https://login.microsoftonline.com/common/oauth2/authorize
Rozsahy
Name |
Description |
user_impersonation
|
zosobnění uživatelského účtu
|
Příklady
GetEligibleChildResourcesByScope
Ukázkový požadavek
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
Ukázková odpověď
{
"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"
}
]
}
Definice
CloudError
Objekt
Chybová odpověď ze služby.
CloudErrorBody
Objekt
Chybová odpověď ze služby.
Name |
Typ |
Description |
code
|
string
|
Identifikátor chyby. Kódy jsou invariantní a mají být využity programově.
|
message
|
string
|
Zpráva popisující chybu, která má být vhodná pro zobrazení v uživatelském rozhraní.
|
EligibleChildResource
Objekt
Způsobilý podřízený prostředek
Name |
Typ |
Description |
id
|
string
|
ID oboru prostředku.
|
name
|
string
|
Název prostředku.
|
type
|
string
|
Typ prostředku.
|
EligibleChildResourcesListResult
Objekt
Výsledek operace seznamu způsobilých podřízených prostředků
Name |
Typ |
Description |
nextLink
|
string
|
Adresa URL, která se má použít k získání další sady výsledků.
|
value
|
EligibleChildResource[]
|
Způsobilý podřízený seznam zdrojů
|