@@ -57,7 +57,7 @@ func TestAccBackendAccessKeyBasic(t *testing.T) {
57
57
}
58
58
defer m .destroyTestResources (ctx )
59
59
60
- clearEnv ()
60
+ clearARMEnv ()
61
61
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
62
62
"storage_account_name" : m .names .storageAccountName ,
63
63
"container_name" : m .names .storageContainerName ,
@@ -89,7 +89,7 @@ func TestAccBackendSASTokenBasic(t *testing.T) {
89
89
t .Fatalf ("Error building SAS Token: %+v" , err )
90
90
}
91
91
92
- clearEnv ()
92
+ clearARMEnv ()
93
93
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
94
94
"storage_account_name" : m .names .storageAccountName ,
95
95
"container_name" : m .names .storageContainerName ,
@@ -106,6 +106,16 @@ func TestAccBackendGithubOIDCBasic(t *testing.T) {
106
106
107
107
testAccAzureBackendRunningInGitHubActions (t )
108
108
109
+ oidcRequestToken := os .Getenv ("ACTIONS_ID_TOKEN_REQUEST_TOKEN" )
110
+ if oidcRequestToken == "" {
111
+ t .Fatalf ("Missing ACTIONS_ID_TOKEN_REQUEST_TOKEN" )
112
+ }
113
+
114
+ oidcRequestURL := os .Getenv ("ACTIONS_ID_TOKEN_REQUEST_URL" )
115
+ if oidcRequestURL == "" {
116
+ t .Fatalf ("Missing ACTIONS_ID_TOKEN_REQUEST_URL" )
117
+ }
118
+
109
119
ctx := newCtx ()
110
120
m := BuildTestMeta (t , ctx )
111
121
@@ -116,14 +126,16 @@ func TestAccBackendGithubOIDCBasic(t *testing.T) {
116
126
}
117
127
defer m .destroyTestResources (ctx )
118
128
119
- clearEnv ()
129
+ clearARMEnv ()
120
130
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
121
131
"subscription_id" : m .subscriptionId ,
122
132
"resource_group_name" : m .names .resourceGroup ,
123
133
"storage_account_name" : m .names .storageAccountName ,
124
134
"container_name" : m .names .storageContainerName ,
125
135
"key" : m .names .storageKeyName ,
126
136
"use_oidc" : true ,
137
+ "oidc_request_token" : oidcRequestToken ,
138
+ "oidc_request_url" : oidcRequestURL ,
127
139
"tenant_id" : m .tenantId ,
128
140
"client_id" : m .clientId ,
129
141
"environment" : m .env .Name ,
@@ -132,6 +144,55 @@ func TestAccBackendGithubOIDCBasic(t *testing.T) {
132
144
backend .TestBackendStates (t , b )
133
145
}
134
146
147
+ func TestAccBackendADOPipelinesOIDCBasic (t * testing.T ) {
148
+ t .Parallel ()
149
+
150
+ testAccAzureBackendRunningInADOPipelines (t )
151
+
152
+ oidcRequestToken := os .Getenv ("SYSTEM_ACCESSTOKEN" )
153
+ if oidcRequestToken == "" {
154
+ t .Fatalf ("Missing SYSTEM_ACCESSTOKEN" )
155
+ }
156
+
157
+ oidcRequestURL := os .Getenv ("SYSTEM_OIDCREQUESTURI" )
158
+ if oidcRequestURL == "" {
159
+ t .Fatalf ("Missing SYSTEM_OIDCREQUESTURI" )
160
+ }
161
+
162
+ adoPipelineServiceConnectionId := os .Getenv ("ARM_ADO_PIPELINE_SERVICE_CONNECTION_ID" )
163
+ if adoPipelineServiceConnectionId == "" {
164
+ t .Fatalf ("Missing ARM_ADO_PIPELINE_SERVICE_CONNECTION_ID" )
165
+ }
166
+
167
+ ctx := newCtx ()
168
+ m := BuildTestMeta (t , ctx )
169
+
170
+ err := m .buildTestResources (ctx )
171
+ if err != nil {
172
+ m .destroyTestResources (ctx )
173
+ t .Fatalf ("Error creating Test Resources: %q" , err )
174
+ }
175
+ defer m .destroyTestResources (ctx )
176
+
177
+ clearARMEnv ()
178
+ b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
179
+ "subscription_id" : m .subscriptionId ,
180
+ "resource_group_name" : m .names .resourceGroup ,
181
+ "storage_account_name" : m .names .storageAccountName ,
182
+ "container_name" : m .names .storageContainerName ,
183
+ "key" : m .names .storageKeyName ,
184
+ "use_oidc" : true ,
185
+ "oidc_request_token" : oidcRequestToken ,
186
+ "oidc_request_url" : oidcRequestURL ,
187
+ "ado_pipeline_service_connection_id" : adoPipelineServiceConnectionId ,
188
+ "tenant_id" : m .tenantId ,
189
+ "client_id" : m .clientId ,
190
+ "environment" : m .env .Name ,
191
+ })).(* Backend )
192
+
193
+ backend .TestBackendStates (t , b )
194
+ }
195
+
135
196
func TestAccBackendAzureADAuthBasic (t * testing.T ) {
136
197
t .Parallel ()
137
198
@@ -147,7 +208,7 @@ func TestAccBackendAzureADAuthBasic(t *testing.T) {
147
208
}
148
209
defer m .destroyTestResources (ctx )
149
210
150
- clearEnv ()
211
+ clearARMEnv ()
151
212
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
152
213
"subscription_id" : m .subscriptionId ,
153
214
"resource_group_name" : m .names .resourceGroup ,
@@ -179,7 +240,7 @@ func TestAccBackendManagedServiceIdentityBasic(t *testing.T) {
179
240
}
180
241
defer m .destroyTestResources (ctx )
181
242
182
- clearEnv ()
243
+ clearARMEnv ()
183
244
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
184
245
"subscription_id" : m .subscriptionId ,
185
246
"resource_group_name" : m .names .resourceGroup ,
@@ -215,7 +276,7 @@ func TestAccBackendServicePrincipalClientCertificateBasic(t *testing.T) {
215
276
}
216
277
defer m .destroyTestResources (ctx )
217
278
218
- clearEnv ()
279
+ clearARMEnv ()
219
280
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
220
281
"subscription_id" : m .subscriptionId ,
221
282
"resource_group_name" : m .names .resourceGroup ,
@@ -247,7 +308,7 @@ func TestAccBackendServicePrincipalClientSecretBasic(t *testing.T) {
247
308
}
248
309
defer m .destroyTestResources (ctx )
249
310
250
- clearEnv ()
311
+ clearARMEnv ()
251
312
b := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
252
313
"subscription_id" : m .subscriptionId ,
253
314
"resource_group_name" : m .names .resourceGroup ,
@@ -278,7 +339,7 @@ func TestAccBackendAccessKeyLocked(t *testing.T) {
278
339
}
279
340
defer m .destroyTestResources (ctx )
280
341
281
- clearEnv ()
342
+ clearARMEnv ()
282
343
283
344
b1 := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
284
345
"storage_account_name" : m .names .storageAccountName ,
@@ -318,7 +379,7 @@ func TestAccBackendServicePrincipalLocked(t *testing.T) {
318
379
}
319
380
defer m .destroyTestResources (ctx )
320
381
321
- clearEnv ()
382
+ clearARMEnv ()
322
383
323
384
b1 := backend .TestBackendConfig (t , New (), backend .TestWrapConfig (map [string ]interface {}{
324
385
"subscription_id" : m .subscriptionId ,
0 commit comments