This repository was archived by the owner on Jun 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathConfigure-Function.ps1
More file actions
40 lines (36 loc) · 2.04 KB
/
Copy pathConfigure-Function.ps1
File metadata and controls
40 lines (36 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[CmdletBinding()]
param (
# Name of the Function App
[Parameter(Mandatory)]
[String]
$FunctionAppName,
# Name of the Resource Group
[Parameter(Mandatory)]
[String]
$ResourceGroupName,
# Source Event Hubs Namespace
[Parameter(Mandatory)]
[String]
$SourceNamespacename,
# Name of the source Event Hub
[Parameter(Mandatory)]
[String]
$SourceEventHubName,
# Target Event Hubs Namespace
[Parameter(Mandatory)]
[String]
$TargetNamespacename,
# Name of the target Event Hub
[Parameter(Mandatory)]
[String]
$TargetEventHubName
)
# Configure the source
$null = az eventhubs eventhub authorization-rule create --resource-group $ResourceGroupName --namespace-name $SourceNamespacename --eventhub-name "telemetry" --name "replication-listen" --rights Listen
$cxnstring = $(az eventhubs eventhub authorization-rule keys list --resource-group $ResourceGroupName --namespace-name $SourceNamespacename --eventhub-name "telemetry" --name "replication-listen" --output=json | ConvertFrom-Json -AsHashtable).primaryConnectionString
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "telemetry-source-connection=$cxnstring"
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "telemetry-source-consumergroup=$FunctionAppName.telemetry"
# Configure the target
$null = az eventhubs eventhub authorization-rule create --resource-group $ResourceGroupName --namespace-name $TargetNamespacename --eventhub-name "telemetry" --name replication-send --rights Send
$cxnstring = $(az eventhubs eventhub authorization-rule keys list --resource-group $ResourceGroupName --namespace-name $TargetNamespacename --eventhub-name "telemetry" --name replication-send --output=json | ConvertFrom-Json -AsHashtable ).primaryConnectionString
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "telemetry-target-connection=$cxnstring"