-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-keyvault-get-secret.bpmn
186 lines (185 loc) · 9.99 KB
/
azure-keyvault-get-secret.bpmn
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" id="Definitions_0sdny8d" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.7.0">
<bpmn:process id="azure-keyvault-get-secret" name="Onify Blueprint: Get secret from Azure Key vault" isExecutable="true">
<bpmn:startEvent id="start" name="Fetch secret">
<bpmn:outgoing>Flow_0wk332j</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="getAzureCredentials" name="Get Azure credentials">
<bpmn:extensionElements>
<camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="url">/my/config/settings/_azure_credentials</camunda:inputParameter>
</camunda:inputOutput>
<camunda:connectorId>onifyApiRequest</camunda:connectorId>
</camunda:connector>
<camunda:inputOutput>
<camunda:outputParameter name="azureCredentials">${content.output.body.value}</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0pu51vz</bpmn:incoming>
<bpmn:outgoing>Flow_0gaktxo</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="generateAccessToken" name="Generate Azure access token">
<bpmn:extensionElements>
<camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="form">
<camunda:map>
<camunda:entry key="client_id">${environment.output.azureCredentials.client_id}</camunda:entry>
<camunda:entry key="scope">https://vault.azure.net/.default</camunda:entry>
<camunda:entry key="client_secret">${environment.output.azureCredentials.client_secret}</camunda:entry>
<camunda:entry key="grant_type">client_credentials</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="responseType">json</camunda:inputParameter>
<camunda:inputParameter name="method">POST</camunda:inputParameter>
<camunda:inputParameter name="headers">
<camunda:map>
<camunda:entry key="Content-Type">application/x-www-form-urlencoded</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="url">https://login.microsoftonline.com/${environment.output.azureCredentials.tenant}/oauth2/v2.0/token</camunda:inputParameter>
</camunda:inputOutput>
<camunda:connectorId>httpRequest</camunda:connectorId>
</camunda:connector>
<camunda:inputOutput>
<camunda:outputParameter name="accessToken">${content.output.body.access_token}</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0gaktxo</bpmn:incoming>
<bpmn:outgoing>Flow_0t7vdw4</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="getSecret" name="Get secret">
<bpmn:extensionElements>
<camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="responseType">json</camunda:inputParameter>
<camunda:inputParameter name="headers">
<camunda:map>
<camunda:entry key="Authorization">Bearer ${environment.output.accessToken}</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="url">${environment.variables.input.secretIdentifier}?api-version=7.3</camunda:inputParameter>
<camunda:inputParameter name="method">GET</camunda:inputParameter>
</camunda:inputOutput>
<camunda:connectorId>httpRequest</camunda:connectorId>
</camunda:connector>
<camunda:inputOutput>
<camunda:outputParameter name="output">
<camunda:script scriptFormat="js">const output = {
value: content.output.body.value,
contentType: content.output.body.contentType
};
next(null, output);
</camunda:script>
</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0t7vdw4</bpmn:incoming>
<bpmn:outgoing>Flow_07nd58u</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="end" name="Secret fetched">
<bpmn:incoming>Flow_07nd58u</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0wk332j" sourceRef="start" targetRef="Gateway_08w1b0y" />
<bpmn:sequenceFlow id="Flow_0gaktxo" sourceRef="getAzureCredentials" targetRef="generateAccessToken" />
<bpmn:sequenceFlow id="Flow_0t7vdw4" sourceRef="generateAccessToken" targetRef="getSecret" />
<bpmn:sequenceFlow id="Flow_07nd58u" sourceRef="getSecret" targetRef="end" />
<bpmn:exclusiveGateway id="Gateway_08w1b0y">
<bpmn:incoming>Flow_0wk332j</bpmn:incoming>
<bpmn:outgoing>Flow_0pu51vz</bpmn:outgoing>
<bpmn:outgoing>Flow_1onrlfk</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="Flow_0pu51vz" sourceRef="Gateway_08w1b0y" targetRef="getAzureCredentials">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${environment.variables.input.secretIdentifier}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_1onrlfk" name="Missing secretIdentifier" sourceRef="Gateway_08w1b0y" targetRef="Event_1c7lzsh">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${true}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="Event_1c7lzsh" name="Could not fetch secret">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="status">
<camunda:map>
<camunda:entry key="error">${true}</camunda:entry>
<camunda:entry key="statuskey">stop</camunda:entry>
<camunda:entry key="statuscode">500</camunda:entry>
<camunda:entry key="statusmessage">Missing secretIdentifier variable</camunda:entry>
</camunda:map>
</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1onrlfk</bpmn:incoming>
<bpmn:errorEventDefinition id="ErrorEventDefinition_1d7axgs" />
</bpmn:endEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="azure-keyvault-get-secret">
<bpmndi:BPMNShape id="BPMNShape_0b8pnki" bpmnElement="start" bioc:stroke="#43a047" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#43a047">
<dc:Bounds x="172" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="160" y="145" width="62" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1w26zg9" bpmnElement="getAzureCredentials">
<dc:Bounds x="380" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1ueqp4f" bpmnElement="generateAccessToken">
<dc:Bounds x="556" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_0jed6ru" bpmnElement="getSecret">
<dc:Bounds x="726" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1xyuqbe" bpmnElement="end" bioc:stroke="#e53935" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#e53935">
<dc:Bounds x="892" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="875" y="145" width="71" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_08w1b0y_di" bpmnElement="Gateway_08w1b0y" isMarkerVisible="true">
<dc:Bounds x="265" y="95" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="253" y="65" width="74" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1b3d1bz_di" bpmnElement="Event_1c7lzsh" bioc:stroke="#e53935" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#e53935">
<dc:Bounds x="412" y="212" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="393" y="255" width="74" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_03deq98" bpmnElement="Flow_0wk332j">
<di:waypoint x="208" y="120" />
<di:waypoint x="265" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_1q21mhv" bpmnElement="Flow_0gaktxo">
<di:waypoint x="480" y="120" />
<di:waypoint x="556" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_12dojo3" bpmnElement="Flow_0t7vdw4">
<di:waypoint x="656" y="120" />
<di:waypoint x="726" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_07z2lys" bpmnElement="Flow_07nd58u">
<di:waypoint x="826" y="120" />
<di:waypoint x="892" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0pu51vz_di" bpmnElement="Flow_0pu51vz">
<di:waypoint x="315" y="120" />
<di:waypoint x="380" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="315" y="102" width="30" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1onrlfk_di" bpmnElement="Flow_1onrlfk">
<di:waypoint x="290" y="145" />
<di:waypoint x="290" y="230" />
<di:waypoint x="412" y="230" />
<bpmndi:BPMNLabel>
<dc:Bounds x="303" y="196" width="74" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>