Share via


Authorization Rules - Event Hubs - Regenerate Keys

Regenerates the ACS and SAS connection strings for the Event Hub.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys?api-version=2024-01-01

URI Parameters

Name In Required Type Description
authorizationRuleName
path True

string

minLength: 1

The authorization rule name.

eventHubName
path True

string

minLength: 1
maxLength: 256

The Event Hub name

namespaceName
path True

string

minLength: 6
maxLength: 50
pattern: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$

The Namespace name

resourceGroupName
path True

string

minLength: 1
maxLength: 90

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.

Request Body

Name Required Type Description
keyType True

KeyType

The access key to regenerate.

key

string

Optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType

Responses

Name Type Description
200 OK

AccessKeys

Connection strings successfully regenerated.

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

EventHubAuthorizationRuleRegenerateKey

Sample request

POST https://management.azure.com/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-namespace-960/eventhubs/sdk-EventHub-532/authorizationRules/sdk-Authrules-1534/regenerateKeys?api-version=2024-01-01

{
  "keyType": "PrimaryKey"
}

Sample response

{
  "primaryConnectionString": "Endpoint=sb://sdk-namespace-9027.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1534;SharedAccessKey=#############################################;EntityPath=sdk-EventHub-1647",
  "secondaryConnectionString": "Endpoint=sb://sdk-namespace-9027.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1534;SharedAccessKey=#############################################;EntityPath=sdk-EventHub-1647",
  "primaryKey": "#############################################",
  "secondaryKey": "#############################################",
  "keyName": "sdk-Authrules-1534"
}

Definitions

Name Description
AccessKeys

Namespace/EventHub Connection String

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.

KeyType

The access key to regenerate.

RegenerateAccessKeyParameters

Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset.

AccessKeys

Namespace/EventHub Connection String

Name Type Description
aliasPrimaryConnectionString

string

Primary connection string of the alias if GEO DR is enabled

aliasSecondaryConnectionString

string

Secondary connection string of the alias if GEO DR is enabled

keyName

string

A string that describes the AuthorizationRule.

primaryConnectionString

string

Primary connection string of the created namespace AuthorizationRule.

primaryKey

string

A base64-encoded 256-bit primary key for signing and validating the SAS token.

secondaryConnectionString

string

Secondary connection string of the created namespace AuthorizationRule.

secondaryKey

string

A base64-encoded 256-bit primary key for signing and validating the SAS token.

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.

KeyType

The access key to regenerate.

Value Description
PrimaryKey
SecondaryKey

RegenerateAccessKeyParameters

Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset.

Name Type Description
key

string

Optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType

keyType

KeyType

The access key to regenerate.