-
Notifications
You must be signed in to change notification settings - Fork 16
/
demo.ps1
27 lines (18 loc) · 1 KB
/
demo.ps1
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
#bash
#values form previous run for Event Hub
$eventhub="your hub name"; # <<<<<--- please provide short name of eventhub from previous run
$groupname="Demo-AZ204-EH"
# to avoid name collisions generate unique name for your account
$account="eventgrid"+(Get-Random);
#Create a resource group
New-AzResourceGroup -location eastus -name Demo-AZ204-EH;
#Enable the Event Grid resource provider
Register-AzResourceProvider -ProviderNamespace Microsoft.EventGrid;
#Create a resource group to monitor
New-AzResourceGroup -location eastus -name Demo-AZ204-monitor;
#Pull azure subscription id
$subid=(az account show --query id -o tsv)
#Сonfigure event subscription endpoint
$endpoint="/subscriptions/$subid/resourceGroups/$groupname/providers/Microsoft.EventHub/namespaces/$eventhub/eventhubs/$eventhub";
#Create a subscription for the events from Resourece group
New-AzEventGridSubscription -EventSubscriptionName "group-monitor-sub" -EndpointType "eventhub" -Endpoint $endpoint -ResourceGroup "Demo-AZ204-monitor";