Obtient la liste des règles d’autorisation d’un espace de noms.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules?api-version=2024-01-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
namespaceName
|
path |
True
|
string
|
Nom de l’espace de noms
Modèle d’expression régulière: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$
|
resourceGroupName
|
path |
True
|
string
|
Nom du groupe de ressources au sein de l’abonnement Azure.
|
subscriptionId
|
path |
True
|
string
|
Informations d’identification d’abonnement qui identifient de manière unique un abonnement Microsoft Azure. L’ID d’abonnement fait partie de l’URI pour chaque appel de service.
|
api-version
|
query |
True
|
string
|
Version de l’API cliente.
|
Réponses
Nom |
Type |
Description |
200 OK
|
AuthorizationRuleListResult
|
Namespace AuthorizationRule a été retourné avec succès.
|
Other Status Codes
|
ErrorResponse
|
Réponse d’erreur Eventhub décrivant la raison de l’échec de l’opération.
|
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom |
Description |
user_impersonation
|
Emprunter l’identité de votre compte d’utilisateur
|
Exemples
ListAuthorizationRules
Exemple de requête
GET https://management.azure.com/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/authorizationRules?api-version=2024-01-01
/**
* Samples for Namespaces ListAuthorizationRules.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/
* EHNameSpaceAuthorizationRuleListAll.json
*/
/**
* Sample code: ListAuthorizationRules.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listAuthorizationRules(com.azure.resourcemanager.AzureResourceManager azure) {
azure.eventHubs().manager().serviceClient().getNamespaces().listAuthorizationRules("ArunMonocle",
"sdk-Namespace-2702", 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventhub import EventHubManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventhub
# USAGE
python eh_name_space_authorization_rule_list_all.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventHubManagementClient(
credential=DefaultAzureCredential(),
subscription_id="5f750a97-50d9-4e36-8081-c9ee4c0210d4",
)
response = client.namespaces.list_authorization_rules(
resource_group_name="ArunMonocle",
namespace_name="sdk-Namespace-2702",
)
for item in response:
print(item)
# x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventhub_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b574e2a41acda14a90ef237006e8bbdda2b63c63/specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json
func ExampleNamespacesClient_NewListAuthorizationRulesPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventhub.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewNamespacesClient().NewListAuthorizationRulesPager("ArunMonocle", "sdk-Namespace-2702", nil)
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.AuthorizationRuleListResult = armeventhub.AuthorizationRuleListResult{
// Value: []*armeventhub.AuthorizationRule{
// {
// Name: to.Ptr("RootManageSharedAccessKey"),
// Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"),
// ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/RootManageSharedAccessKey"),
// Properties: &armeventhub.AuthorizationRuleProperties{
// Rights: []*armeventhub.AccessRights{
// to.Ptr(armeventhub.AccessRightsListen),
// to.Ptr(armeventhub.AccessRightsManage),
// to.Ptr(armeventhub.AccessRightsSend)},
// },
// },
// {
// Name: to.Ptr("sdk-Authrules-1746"),
// Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"),
// ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/sdk-Authrules-1746"),
// Properties: &armeventhub.AuthorizationRuleProperties{
// Rights: []*armeventhub.AccessRights{
// to.Ptr(armeventhub.AccessRightsListen),
// to.Ptr(armeventhub.AccessRightsSend)},
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventHubManagementClient } = require("@azure/arm-eventhub");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a list of authorization rules for a Namespace.
*
* @summary Gets a list of authorization rules for a Namespace.
* x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json
*/
async function listAuthorizationRules() {
const subscriptionId =
process.env["EVENTHUB_SUBSCRIPTION_ID"] || "5f750a97-50d9-4e36-8081-c9ee4c0210d4";
const resourceGroupName = process.env["EVENTHUB_RESOURCE_GROUP"] || "ArunMonocle";
const namespaceName = "sdk-Namespace-2702";
const credential = new DefaultAzureCredential();
const client = new EventHubManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.namespaces.listAuthorizationRules(
resourceGroupName,
namespaceName,
)) {
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.EventHubs.Models;
using Azure.ResourceManager.EventHubs;
// Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json
// this example is just showing the usage of "Namespaces_ListAuthorizationRules" 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);
// this example assumes you already have this EventHubsNamespaceResource created on azure
// for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource
string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4";
string resourceGroupName = "ArunMonocle";
string namespaceName = "sdk-Namespace-2702";
ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName);
EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId);
// get the collection of this EventHubsNamespaceAuthorizationRuleResource
EventHubsNamespaceAuthorizationRuleCollection collection = eventHubsNamespace.GetEventHubsNamespaceAuthorizationRules();
// invoke the operation and iterate over the result
await foreach (EventHubsNamespaceAuthorizationRuleResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventHubsAuthorizationRuleData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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
Exemple de réponse
{
"value": [
{
"id": "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/RootManageSharedAccessKey",
"name": "RootManageSharedAccessKey",
"type": "Microsoft.EventHub/Namespaces/AuthorizationRules",
"properties": {
"rights": [
"Listen",
"Manage",
"Send"
]
}
},
{
"id": "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/sdk-Authrules-1746",
"name": "sdk-Authrules-1746",
"type": "Microsoft.EventHub/Namespaces/AuthorizationRules",
"properties": {
"rights": [
"Listen",
"Send"
]
}
}
]
}
Définitions
Nom |
Description |
AccessRights
|
Droits associés à la règle.
|
AuthorizationRule
|
Élément unique dans une opération List ou Get AuthorizationRule
|
AuthorizationRuleListResult
|
Réponse de l’opération d’espace de noms List.
|
createdByType
|
Type d’identité qui a créé la ressource.
|
ErrorAdditionalInfo
|
Informations supplémentaires sur l’erreur de gestion des ressources.
|
ErrorDetail
|
Détail de l’erreur.
|
ErrorResponse
|
La réponse d’erreur indique que le service Event Hub n’est pas en mesure de traiter la demande entrante. La raison est fournie dans le message d’erreur.
|
systemData
|
Métadonnées relatives à la création et à la dernière modification de la ressource.
|
AccessRights
Droits associés à la règle.
Nom |
Type |
Description |
Listen
|
string
|
|
Manage
|
string
|
|
Send
|
string
|
|
AuthorizationRule
Élément unique dans une opération List ou Get AuthorizationRule
Nom |
Type |
Description |
id
|
string
|
ID de ressource complet pour la ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
location
|
string
|
Emplacement géographique où réside la ressource
|
name
|
string
|
nom de la ressource.
|
properties.rights
|
AccessRights[]
|
Droits associés à la règle.
|
systemData
|
systemData
|
Métadonnées système relatives à cette ressource.
|
type
|
string
|
Type de la ressource. Par exemple, « Microsoft.EventHub/Namespaces » ou « Microsoft.EventHub/Namespaces/EventHubs »
|
AuthorizationRuleListResult
Réponse de l’opération d’espace de noms List.
Nom |
Type |
Description |
nextLink
|
string
|
Lien vers l’ensemble de résultats suivant. Non vide si Value contient une liste incomplète de règles d’autorisation
|
value
|
AuthorizationRule[]
|
Résultat de l’opération Répertorier les règles d’autorisation.
|
createdByType
Type d’identité qui a créé la ressource.
Nom |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Informations supplémentaires sur l’erreur de gestion des ressources.
Nom |
Type |
Description |
info
|
object
|
Informations supplémentaires
|
type
|
string
|
Type d’informations supplémentaires.
|
ErrorDetail
Détail de l’erreur.
Nom |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Informations supplémentaires sur l’erreur.
|
code
|
string
|
Code d'erreur.
|
details
|
ErrorDetail[]
|
Détails de l’erreur.
|
message
|
string
|
Message d’erreur.
|
target
|
string
|
Cible d’erreur.
|
ErrorResponse
La réponse d’erreur indique que le service Event Hub n’est pas en mesure de traiter la demande entrante. La raison est fournie dans le message d’erreur.
systemData
Métadonnées relatives à la création et à la dernière modification de la ressource.
Nom |
Type |
Description |
createdAt
|
string
|
Horodatage de la création de ressources (UTC).
|
createdBy
|
string
|
Identité qui a créé la ressource.
|
createdByType
|
createdByType
|
Type d’identité qui a créé la ressource.
|
lastModifiedAt
|
string
|
Type d’identité qui a modifié la dernière ressource.
|
lastModifiedBy
|
string
|
Identité qui a modifié la dernière ressource.
|
lastModifiedByType
|
createdByType
|
Type d’identité qui a modifié la dernière ressource.
|