Gets an AuthorizationRule for a Namespace by rule name.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}?api-version=2024-01-01
URI Parameters
Name |
In |
Required |
Type |
Description |
authorizationRuleName
|
path |
True
|
string
|
The authorization rule name.
|
namespaceName
|
path |
True
|
string
|
The Namespace name
Regex pattern: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$
|
resourceGroupName
|
path |
True
|
string
|
Name of the resource group within the azure subscription.
|
subscriptionId
|
path |
True
|
string
|
Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client API Version.
|
Responses
Name |
Type |
Description |
200 OK
|
AuthorizationRule
|
Namespace AuthorizationRule returned successfully.
|
Other Status Codes
|
ErrorResponse
|
Eventhub error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
NameSpaceAuthorizationRuleGet
Sample request
GET https://management.azure.com/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/authorizationRules/sdk-Authrules-1746?api-version=2024-01-01
/**
* Samples for Namespaces GetAuthorizationRule.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/
* EHNameSpaceAuthorizationRuleGet.json
*/
/**
* Sample code: NameSpaceAuthorizationRuleGet.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void nameSpaceAuthorizationRuleGet(com.azure.resourcemanager.AzureResourceManager azure) {
azure.eventHubs().manager().serviceClient().getNamespaces().getAuthorizationRuleWithResponse("ArunMonocle",
"sdk-Namespace-2702", "sdk-Authrules-1746", 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_get.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.get_authorization_rule(
resource_group_name="ArunMonocle",
namespace_name="sdk-Namespace-2702",
authorization_rule_name="sdk-Authrules-1746",
)
print(response)
# x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleGet.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/EHNameSpaceAuthorizationRuleGet.json
func ExampleNamespacesClient_GetAuthorizationRule() {
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)
}
res, err := clientFactory.NewNamespacesClient().GetAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AuthorizationRule = armeventhub.AuthorizationRule{
// 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/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 an AuthorizationRule for a Namespace by rule name.
*
* @summary Gets an AuthorizationRule for a Namespace by rule name.
* x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleGet.json
*/
async function nameSpaceAuthorizationRuleGet() {
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 authorizationRuleName = "sdk-Authrules-1746";
const credential = new DefaultAzureCredential();
const client = new EventHubManagementClient(credential, subscriptionId);
const result = await client.namespaces.getAuthorizationRule(
resourceGroupName,
namespaceName,
authorizationRuleName,
);
console.log(result);
}
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/EHNameSpaceAuthorizationRuleGet.json
// this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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
string authorizationRuleName = "sdk-Authrules-1746";
NullableResponse<EventHubsNamespaceAuthorizationRuleResource> response = await collection.GetIfExistsAsync(authorizationRuleName);
EventHubsNamespaceAuthorizationRuleResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// the variable result 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 = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules/sdk-Authrules-1746",
"name": "sdk-Authrules-1746",
"type": "Microsoft.EventHub/Namespaces/AuthorizationRules",
"properties": {
"rights": [
"Listen",
"Send"
]
}
}
Definitions
Name |
Description |
AccessRights
|
The rights associated with the rule.
|
AuthorizationRule
|
Single item in a List or Get AuthorizationRule operation
|
createdByType
|
The type of identity that created the resource.
|
ErrorAdditionalInfo
|
The resource management error additional info.
|
ErrorDetail
|
The error detail.
|
ErrorResponse
|
Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message.
|
systemData
|
Metadata pertaining to creation and last modification of the resource.
|
AccessRights
The rights associated with the rule.
Name |
Type |
Description |
Listen
|
string
|
|
Manage
|
string
|
|
Send
|
string
|
|
AuthorizationRule
Single item in a List or Get AuthorizationRule operation
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
location
|
string
|
The geo-location where the resource lives
|
name
|
string
|
The name of the resource
|
properties.rights
|
AccessRights[]
|
The rights associated with the rule.
|
systemData
|
systemData
|
The system meta data relating to this resource.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs"
|
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message.
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The type of identity that last modified the resource.
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|