Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 2c424ce

Browse files
authored
Provide "Deploy To Azure" button for Azure Key Vault background job (#27)
* Ignore docs/_site * WIP * Initial test * First working version, but still fixed * Finalize template * Provide deploy button * Switch to correct repo
1 parent 392163e commit 2c424ce

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"EventGrid.Subscription.Name": {
6+
"defaultValue": "Arcus-Background-Jobs-Secret-Renewed",
7+
"minLength": 3,
8+
"maxLength": 64,
9+
"type": "String",
10+
"metadata": {
11+
"description": "Name of the subscription to create"
12+
}
13+
},
14+
"KeyVault.Name": {
15+
"type": "String",
16+
"metadata": {
17+
"description": "Name of the Azure Key Vault"
18+
}
19+
},
20+
"ServiceBus.Namespace.Name": {
21+
"minLength": 6,
22+
"maxLength": 50,
23+
"type": "String",
24+
"metadata": {
25+
"description": "Name of the Service Bus namespace"
26+
}
27+
},
28+
"ServiceBus.Topic.Name": {
29+
"type": "String",
30+
"metadata": {
31+
"description": "Name of the Topic"
32+
}
33+
}
34+
},
35+
"variables": {},
36+
"resources": [
37+
{
38+
"type": "Microsoft.KeyVault/vaults/providers/eventSubscriptions",
39+
"apiVersion": "2020-01-01-preview",
40+
"name": "[concat(parameters('KeyVault.Name'), 'arcus-sandbox/Microsoft.EventGrid/', parameters('EventGrid.Subscription.Name'))]",
41+
"dependsOn": [
42+
"[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('ServiceBus.Namespace.Name'), parameters('ServiceBus.Topic.Name'))]"
43+
],
44+
"properties": {
45+
"destination": {
46+
"endpointType": "ServiceBusTopic",
47+
"properties": {
48+
"resourceId": "[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('ServiceBus.Namespace.Name'), parameters('ServiceBus.Topic.Name'))]"
49+
}
50+
},
51+
"filter": {
52+
"includedEventTypes": [
53+
"Microsoft.KeyVault.SecretNewVersionCreated"
54+
],
55+
"advancedFilters": []
56+
},
57+
"labels": [],
58+
"eventDeliverySchema": "CloudEventSchemaV1_0"
59+
}
60+
},
61+
{
62+
"type": "Microsoft.ServiceBus/namespaces",
63+
"apiVersion": "2017-04-01",
64+
"name": "[parameters('ServiceBus.Namespace.Name')]",
65+
"location": "[resourceGroup().location]",
66+
"sku": {
67+
"name": "Standard"
68+
},
69+
"resources": [
70+
{
71+
"type": "topics",
72+
"apiVersion": "2017-04-01",
73+
"name": "[parameters('ServiceBus.Topic.Name')]",
74+
"dependsOn": [
75+
"[concat('Microsoft.ServiceBus/namespaces/', parameters('ServiceBus.Namespace.Name'))]"
76+
],
77+
"properties": {
78+
"enablePartitioning": "true"
79+
},
80+
"resources": []
81+
}
82+
]
83+
}
84+
],
85+
"outputs": {}
86+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"EventGrid.Subscription.Name": {
6+
"value": "Arcus-Background-Jobs-Secret-Renewed"
7+
},
8+
"ServiceBus.Namespace.Name": {
9+
"value": ""
10+
},
11+
"ServiceBus.Topic.Name": {
12+
"value": ""
13+
},
14+
"KeyVault.Name": {
15+
"value": ""
16+
}
17+
}
18+
}

docs/features/security/auto-invalidate-secrets.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ The `Arcus.BackgroundJobs.KeyVault` library provides a background job to automat
99

1010
## How does it work?
1111

12+
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Farcus.azure%2Farcus.backgroundjobs%2Fmaster%2Fdeploy%2Farm%2Fazure-key-vault-job.json" target="_blank">
13+
<img src="https://azuredeploy.net/deploybutton.png"/>
14+
</a>
15+
16+
1217
This automation works by subscribing on the `SecretNewVersionCreated` event of an Azure Key Vault resource and placing those events on a Azure Service Bus Topic; which we process in our background job.
1318

1419
![Automatically Invalidate Azure Key Vault Secrets](/media/Azure-Key-Vault-Job.png)

0 commit comments

Comments
 (0)