-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathConfigure-Function.ps1
More file actions
41 lines (34 loc) · 2.07 KB
/
Configure-Function.ps1
File metadata and controls
41 lines (34 loc) · 2.07 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
41
[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
)
$null = az eventhubs eventhub authorization-rule create --resource-group $ResourceGroupName --namespace-name $SourceNamespacename --eventhub-name $SourceEventHubName --name replication-listen --rights listen
$cxnstringsource = $(az eventhubs eventhub authorization-rule keys list --resource-group $ResourceGroupName --namespace-name $SourceNamespacename --eventhub-name $SourceEventHubName --name replication-listen --output=json | ConvertFrom-Json -AsHashtable).primaryConnectionString
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "$SourceEventHubName-source-connection=$cxnstringsource"
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "telemetry-source-consumergroup=$FunctionAppName.telemetry"
$null = az eventhubs eventhub authorization-rule create --resource-group $ResourceGroupName --namespace-name $TargetNamespacename --eventhub-name $TargetEventHubName --name replication-send --rights send
$cxnstringtarget = $(az eventhubs eventhub authorization-rule keys list --resource-group $ResourceGroupName --namespace-name $TargetNamespacename --eventhub-name $TargetEventHubName --name replication-send --output=json | ConvertFrom-Json -AsHashtable).primaryConnectionString
$null = az functionapp config appsettings set --name $FunctionAppName --resource-group $ResourceGroupName --settings "$TargetEventHubName-target-connection=$cxnstringtarget"