Skip to content

Commit e8f3625

Browse files
authored
Updating CES configure page (#35797)
1 parent 2229e82 commit e8f3625

File tree

1 file changed

+3
-2
lines changed
  • docs/relational-databases/track-changes/change-event-streaming

1 file changed

+3
-2
lines changed

docs/relational-databases/track-changes/change-event-streaming/configure.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ SAS tokens have a security advantage over service keys: If the client is comprom
6363
To configure streaming to Azure Event Hubs with the AMQP protocol (the default native Azure Event Hubs protocol), create or reuse a shared access policy with **Send** permission and generate a SAS token. You can generate the token programmatically with any programming or scripting language. The example in this article shows how to generate a SAS token from a new or existing policy by using a PowerShell script.
6464

6565
> [!NOTE]
66-
> For improved security, use Microsoft Entra based access control whenever possible. If Microsoft Entra based access control isn't possible and you're using shared access policies, use SAS token authentication instead of service key-based authentication whenever possible. Best practices for SAS tokens include defining an appropriate access scope, setting an expiration date, and rotating the SAS key regularly. For key-based authentication, rotate keys periodically. Store all secrets securely by using Azure Key Vault or a similar service.
66+
> For improved security, using Microsoft Entra based access control whenever possible is **strongly recommended**. If Microsoft Entra based access control isn't possible and you're using shared access policies, use SAS token authentication instead of service key-based authentication whenever possible. Best practices for SAS tokens include defining an appropriate minimally required access scope, setting a short expiration date, and rotating the SAS key regularly. For key-based authentication, rotate keys periodically. Store all secrets securely by using Azure Key Vault or a similar service.
6767
6868
### Install required modules
6969

@@ -120,6 +120,7 @@ $resourceGroupName = "<Resource-group-name>"
120120
$namespaceName = "<Azure-Event-Hub-Namespace-name>"
121121
$eventHubName = "<Azure-Event-Hubs-instance-name>"
122122
$policyName = "<Policy-name>"
123+
$tokenExpireInDays = "<number-of-days-token-will-be-valid>"
123124
124125
# Modifying the rest of the script is not necessary.
125126
@@ -181,7 +182,7 @@ function Create-SasToken {
181182
)
182183
183184
$sinceEpoch = [datetime]::UtcNow - [datetime]"1970-01-01"
184-
$expiry = [int]$sinceEpoch.TotalSeconds + (60 * 60 * 24 * 31 * 6) # 6 months
185+
$expiry = [int]$sinceEpoch.TotalSeconds + ((60 * 60 * 24) * [int]$tokenExpireInDays) # seconds since Unix epoch
185186
$stringToSign = [System.Web.HttpUtility]::UrlEncode($resourceUri) + "`n" + $expiry
186187
$hmac = New-Object System.Security.Cryptography.HMACSHA256
187188
$hmac.Key = [Text.Encoding]::UTF8.GetBytes($key)

0 commit comments

Comments
 (0)