Skip to content

Commit 46f336a

Browse files
committed
no redundant
1 parent a4eb1e1 commit 46f336a

2 files changed

Lines changed: 33 additions & 38 deletions

File tree

README.md

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,22 @@ Last updated: 2026-02-19
4343

4444
- Resource group
4545
- Artifact Signing account (`Microsoft.CodeSigning/codeSigningAccounts`)
46-
- Key Vault (RBAC-enabled) for pipeline variables/secrets
47-
- (Optional) Certificate profile (`.../certificateProfiles`) can be created either:
48-
- by Terraform (if you set `identity_validation_id` and re-apply), or
49-
- by the Azure DevOps pipeline automatically (after you set a Key Vault secret; no Terraform re-run)
50-
- (Optional, Terraform-deployed) Microsoft Entra app registration + service principal for an Azure DevOps **Workload Identity Federation** service connection
51-
- (Optional, Terraform-deployed) Azure DevOps resources (when `ado_enabled = true`):
52-
- Project
53-
- Git repo
54-
- YAML pipeline
55-
- AzureRM service connection (Workload Identity Federation)
56-
- Pipeline authorizations for the service connection + variable group
57-
- (Optional) RBAC assignment(s) for the Azure DevOps service principal
58-
- `Artifact Signing Certificate Profile Signer` at the certificate profile scope (required for signing)
59-
- `Contributor` at the resource group scope (only required if you want the pipeline to create the certificate profile)
46+
- Key Vault (RBAC-enabled) for pipeline variables/secrets (created by default)
47+
- Certificate profile (`.../certificateProfiles`)
48+
- Preferred: created by the Azure DevOps pipeline after you set the Key Vault secret `artifactSigningIdentityValidationId` (no second `terraform apply`)
49+
- Optional: created by Terraform if you set `identity_validation_id` and re-apply
50+
- Optional Azure DevOps resources (when `ado_enabled = true`)
51+
- Entra app registration + service principal
52+
- Azure DevOps project/repo/pipeline/service connection + authorizations
6053

6154
<img width="451" height="622" alt="image" src="https://github.com/user-attachments/assets/1306d110-be8f-49a8-96dc-c0354a2a6404" />
6255

6356
From [What is Artifact Signing?](https://learn.microsoft.com/en-us/azure/artifact-signing/overview)
6457

6558
> [!NOTE]
6659
> - **Identity validation** itself is **portal-only** (service requirement). Terraform can’t complete that workflow.
67-
> - 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.
68-
> - 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).
60+
> - After you complete it, set Key Vault secret `artifactSigningIdentityValidationId` and the pipeline will create the certificate profile automatically.
61+
> - If Terraform creates the Azure DevOps service connection (`ado_enabled = true`), it can read the generated WIF **Issuer/Subject** and create the Entra federated credential automatically.
6962
7063
## Deploy with Terraform
7164

@@ -84,18 +77,14 @@ terraform apply -auto-approve
8477

8578
3) In Azure portal, open the Artifact Signing account and complete **Identity validation** (portal-only).
8679

87-
4) Copy the **Identity validation Id** from the portal and set it in Key Vault (no Terraform re-run required):
80+
4) Copy the **Identity validation Id** from the portal and set it in Key Vault:
8881

8982
```pwsh
90-
az keyvault secret set \
91-
--vault-name <your-keyvault-name> \
92-
--name artifactSigningIdentityValidationId \
93-
--value "00000000-0000-0000-0000-000000000000"
83+
$kvName = terraform -chdir=terraform-infrastructure output -raw keyvault_name
84+
az keyvault secret set --vault-name $kvName --name artifactSigningIdentityValidationId --value "00000000-0000-0000-0000-000000000000"
9485
```
9586

96-
5) Run the Azure DevOps pipeline. The `AzureCLI@2` step will:
97-
- create the certificate profile if it doesn't exist yet
98-
- ensure the `Artifact Signing Certificate Profile Signer` role assignment exists
87+
5) Run the Azure DevOps pipeline. The `AzureCLI@2` step will create the certificate profile if it doesn’t exist yet, then sign the binaries.
9988

10089
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.
10190

@@ -131,22 +120,28 @@ Notes:
131120
## Pipeline
132121

133122
- [azure-pipelines.yml](azure-pipelines.yml) builds `SigningDemo.exe`, installs the required signing components via NuGet extraction, then signs using the official SignTool + `/dlib` flow.
134-
- Configure pipeline variables:
135-
- `artifactSigningEndpoint` (Terraform output `artifact_signing_endpoint`)
136-
- `artifactSigningAccountName` (Terraform output `artifact_signing_account_name`)
137-
- `artifactSigningCertificateProfileName` (your profile name)
138-
- `artifactSigningResourceGroupName` (Terraform `resource_group_name`)
139-
- `artifactSigningIdentityValidationId` (only required until the profile exists; best sourced from Key Vault)
140-
- `artifactSigningCertificateProfileType` (defaults to `PublicTrust` if unset)
141-
- `adoServicePrincipalObjectId` (optional; enables the pipeline to ensure RBAC assignment automatically)
142-
- Service connection name in YAML: update `azureSubscription` if you didn't name it `sc-artifact-signing`.
123+
- If `keyVaultName` is set, the pipeline loads signing values from Key Vault via `AzureKeyVault@2`.
124+
125+
Minimum pipeline variables (when not using the Terraform-managed variable group):
126+
- `azureServiceConnection` (service connection name; default `sc-artifact-signing`)
127+
- `keyVaultName` (Terraform output `keyvault_name`)
128+
- `artifactSigningResourceGroupName` (Terraform `resource_group_name`)
129+
130+
Optional overrides (normally provided by Key Vault):
131+
- `artifactSigningEndpoint`
132+
- `artifactSigningAccountName`
133+
- `artifactSigningCertificateProfileName`
134+
- `artifactSigningIdentityValidationId` (only required until the profile exists)
135+
136+
Optional (only used when creating the certificate profile):
137+
- `artifactSigningCertificateProfileType` (defaults to `PublicTrust` if unset)
138+
- `adoServicePrincipalObjectId`
143139

144140
### Azure Key Vault for pipeline variables
145141

146-
Terraform creates a Key Vault by default. It will:
147-
- create an RBAC-enabled Key Vault
148-
- grant your current identity **Key Vault Secrets Officer** (so you can set secrets)
149-
- grant the Azure DevOps service principal **Key Vault Secrets User** (so the pipeline can read secrets)
142+
Terraform creates a Key Vault by default and wires RBAC so:
143+
- your current identity can set secrets
144+
- the Azure DevOps service principal can read secrets
150145

151146
Terraform also populates these Key Vault secrets during `terraform apply`:
152147
- `artifactSigningEndpoint`

terraform-infrastructure/terraform.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# NOTE: code_signing_account_name must be globally unique.
33

44
location = "eastus"
5-
resource_group_name = "rg-artifact-signing-demo"
5+
resource_group_name = "RG-artifact-signing-demo"
66
code_signing_account_name = "aasdemoREPLACE_ME"
77

88
# After you complete Identity validation in the Azure portal, paste the Identity validation Id here.

0 commit comments

Comments
 (0)