@@ -30,8 +30,10 @@ two flavors:
30
30
31
31
### 2. Add Azure Pipeline Build YAML
32
32
33
- The SPK repository has a [ template] ( ../../azure-pipelines/templates/infra-generation-pipeline.yml ) Azure DevOps pipeline that you may use as reference.
34
- Add the ` infra-generation-pipeline.yml ` file to the root of the Infra HLD repo.
33
+ The SPK repository has a
34
+ [ template] ( ../../azure-pipelines/templates/infra-generation-pipeline.yml ) Azure
35
+ DevOps pipeline that you may use as reference. Add the
36
+ ` infra-generation-pipeline.yml ` file to the root of the Infra HLD repo.
35
37
36
38
### 3. Create Pipeline
37
39
@@ -42,7 +44,7 @@ yaml files (e.g. definition.yaml).
42
44
43
45
In Azure DevOps:
44
46
45
- 1 . Create a Variable Group.
47
+ #### 3.1a . Create a Variable Group.
46
48
47
49
Variable Groups may vary based on the ` azure-pipelines.yml ` used, but for the
48
50
spk ` infra-generation-pipeline.yml ` template, the following variables will need
@@ -69,13 +71,12 @@ AZDO_PROJECT_NAME: The name of the project in your Azure DevOps organization whe
69
71
70
72
You can use ` spk ` to create the Azure DevOps Variable Groups by executing
71
73
` spk variable-group create ` described in this
72
- [ doc] ( ../../guides/variable-group.md ) .
73
- This will require you to create a variable group manifest similar to the
74
- following:
74
+ [ doc] ( ../../guides/variable-group.md ) . This will require you to create a
75
+ variable group manifest similar to the following:
75
76
76
- ```
77
+ ``` yml
77
78
name : " spk-infra-hld-vg"
78
- description: "variable groupd for infra hld"
79
+ description : " variable group for infra hld"
79
80
type : " Vsts"
80
81
variables :
81
82
ACCESS_TOKEN_SECRET :
@@ -87,7 +88,7 @@ variables:
87
88
ARM_SUBSCRIPTION_ID :
88
89
value : " <SUBSCRIPTION-ID>"
89
90
ARM_TENANT_ID :
90
- value: "<SP-TENANT-ID>
91
+ value : " <SP-TENANT-ID>"
91
92
CLUSTER :
92
93
value : " <CLUSTER-NAME>"
93
94
GENERATED_REPO :
@@ -100,12 +101,86 @@ variables:
100
101
value : " <AZURE-DEVOPS-PROJECT-NAME>"
101
102
` ` `
102
103
104
+ 
105
+
106
+ #### 3.1b. Create a Variable Group using Azure Key Vault
107
+
103
108
By using the ` spk variable-group create` you are also able to link variables to
104
- secrets in Azure Keyvault.
109
+ secrets in Azure Keyvault. Create a variable group in the portal or throught the
110
+ ` az` cli.
105
111
106
- ![ ] ( ../images/spk-infra-vg.png )
112
+ > Please note that Key Vault Secret names can only contain alphanumeric
113
+ > characters and dashes.
114
+
115
+ Once the Keyvault has been created, You can now create a variable group manifest
116
+ similar to the following :
117
+
118
+ ` ` ` yml
119
+ name: "spk-infra-hld-vg-kv"
120
+ description: "key vault variable group for infra hld"
121
+ type: "AzureKeyVault"
122
+ variables:
123
+ ACCESS-TOKEN-SECRET:
124
+ enabled: true
125
+ ARM-CLIENT-ID:
126
+ enabled: true
127
+ ARM-CLIENT-SECRET:
128
+ enabled: true
129
+ ARM-SUBSCRIPTION-ID:
130
+ enabled: true
131
+ ARM-TENANT-ID:
132
+ enabled: true
133
+ CLUSTER:
134
+ enabled: true
135
+ GENERATED-REPO:
136
+ enabled: true
137
+ PROJECT-DIRECTORY:
138
+ enabled: true
139
+ AZDO-ORG-NAME: (optional)
140
+ enabled: true
141
+ AZDO-PROJECT-NAME: (optional)
142
+ enabled: true
143
+ key_vault_provider:
144
+ name: "myvault" # name of the Azure Key Vaukt with Secrets
145
+ service_endpoint: # service endpoint is required to authorize with Azure Key Vault
146
+ name: "my-KeyVault"
147
+ # If the service endpoint with this name does not exist, the following values are required to create a new service connection with this name
148
+ subscription_id: "<SUBSCRIPTION-ID>"
149
+ # Azure Subscription id where Key Vault exist
150
+ subscription_name: "<SUBSCRIPTION-NAME>"
151
+ # Azure Subscription name where Key Vault exist
152
+ service_principal_id: "<SP-ID>"
153
+ # Service Principal Id that has 'Get' and 'List' in Key Vault Access Policy
154
+ service_principal_secret: "<SP-PASSWORD>"
155
+ # Service Principal secret for the above Service Principal Id
156
+ tenant_id: "<SP-TENANT-ID>"
157
+ # AAD Tenant Id for the above Service Principal
158
+ ` ` `
159
+
160
+ > Be sure not to commit your variable group manifest to a remote repository
161
+ > unless environment variables were used.
162
+
163
+ Alternatively you can create a variable group through the Azure DevOps UI and
164
+ connect it to the pre-existing Key Vault you created. Navigate to your pipeline
165
+ library and create a new variable group. Identify the key vault that was
166
+ previously provisioned.
167
+
168
+ 
169
+
170
+ Additionally, be sure to select the respective Key secrets you wish to map to
171
+ your variable group.
172
+
173
+ 
174
+
175
+ > When using a variable group, you may be prompted to grant access permission to
176
+ > all pipelines in order for your newly created pipeline to have access to an
177
+ > agent pool and specific service connections. Be sure to navigate to the
178
+ > Pipeline UI to permit permission to use the agent pool and the service
179
+ > connection to authenticate against your key vault.
180
+
181
+ 
107
182
108
- 2 . Create a new pipeline.
183
+ # ### 3. 2. Create a new pipeline.
109
184
110
185
You can use the Azure CLI to create the Generation pipeline. To do that, you
111
186
will need to do the following :
0 commit comments