You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- (Optional, Terraform-deployed) Certificate profile (`.../certificateProfiles`) once you provide an **Identity validation Id**
44
+
- Key Vault (RBAC-enabled) for pipeline variables/secrets
45
+
- (Optional) Certificate profile (`.../certificateProfiles`) can be created either:
46
+
- by Terraform (if you set `identity_validation_id` and re-apply), or
47
+
- by the Azure DevOps pipeline automatically (after you set a Key Vault secret; no Terraform re-run)
45
48
- (Optional, Terraform-deployed) Microsoft Entra app registration + service principal for an Azure DevOps **Workload Identity Federation** service connection
From [What is Artifact Signing?](https://learn.microsoft.com/en-us/azure/artifact-signing/overview)
57
62
58
63
> [!NOTE]
59
-
> -**Identity validation** itself is **portal-only** (service requirement). Terraform can’t complete that workflow; you paste the resulting `identity_validation_id` into `terraform.tfvars`.
64
+
> -**Identity validation** itself is **portal-only** (service requirement). Terraform can’t complete that workflow.
65
+
> - After you complete it, you can avoid a second `terraform apply` by setting the Key Vault secret `artifactSigningIdentityValidationId` and letting the pipeline create the certificate profile.
60
66
> - If Terraform creates the Azure DevOps service connection (`ado_enabled = true`), it can also read the generated WIF **Issuer** and **Subject** and create the Entra **federated credential** automatically (no copy/paste).
61
67
62
68
## Deploy with Terraform
@@ -76,21 +82,20 @@ terraform apply -auto-approve
76
82
77
83
3) In Azure portal, open the Artifact Signing account and complete **Identity validation** (portal-only).
78
84
79
-
4) Copy the **Identity validation Id** from the portal and add it to `terraform-infrastructure/terraform.tfvars`:
85
+
4) Copy the **Identity validation Id** from the portal and set it in Key Vault (no Terraform re-run required):
5) Run the Azure DevOps pipeline. The `AzureCLI@2` step will:
95
+
- create the certificate profile if it doesn't exist yet
96
+
- ensure the `Artifact Signing Certificate Profile Signer` role assignment exists
88
97
89
-
```pwsh
90
-
cd terraform-infrastructure
91
-
terraform validate
92
-
terraform apply -auto-approve
93
-
```
98
+
Optional: If you prefer Terraform to manage the certificate profile instead, set `identity_validation_id` in `terraform-infrastructure/terraform.tfvars` and run `terraform apply` again.
az rest --method get --url $profileUrl --only-show-errors | Out-Null
82
+
$profileExists = $true
83
+
} catch {
84
+
$profileExists = $false
85
+
}
86
+
87
+
if (-not $profileExists) {
88
+
if ([string]::IsNullOrWhiteSpace($identityValidationId)) {
89
+
throw "Certificate profile is missing. Complete identity validation in the portal and set Key Vault secret 'artifactSigningIdentityValidationId' (or set pipeline variable artifactSigningIdentityValidationId)."
90
+
}
91
+
92
+
$body = @{
93
+
properties = @{
94
+
identityValidationId = $identityValidationId
95
+
profileType = $profileType
96
+
includeStreetAddress = $false
97
+
includePostalCode = $false
98
+
}
99
+
} | ConvertTo-Json -Depth 10
100
+
101
+
az rest --method put --url $profileUrl --body $body --only-show-errors | Out-Null
0 commit comments