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
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-tutorial-sign-build-push.md
+61-9Lines changed: 61 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,8 @@ In this tutorial:
64
64
1. Configure AKV resource names.
65
65
66
66
```bash
67
+
AKV_SUB_ID=myAkvSubscriptionId
68
+
AKV_RG=myAkvResourceGroup
67
69
# Name of the existing AKV used to store the signing keys
68
70
AKV_NAME=myakv
69
71
# Name of the certificate created in AKV
@@ -75,6 +77,8 @@ In this tutorial:
75
77
2. Configure ACR and image resource names.
76
78
77
79
```bash
80
+
ACR_SUB_ID=myAcrSubscriptionId
81
+
ACR_RG=myAcrResourceGroup
78
82
# Name of the existing registry example: myregistry.azurecr.io
79
83
ACR_NAME=myregistry
80
84
# Existing full domain of the ACR
@@ -95,23 +99,71 @@ az login
95
99
96
100
To learn more about Azure CLI and how to sign in with it, see [Sign in with Azure CLI](/cli/azure/authenticate-azure-cli).
97
101
98
-
## Assign access policy in AKV (Azure CLI)
102
+
## Access control
99
103
100
-
A user principal with the correct access policy permissions is needed to create a self-signed certificate and sign artifacts. This principal can be a user principal, service principal, or managed identity. At a minimum, this principal needs the following permissions:
104
+
When working with ACR and AKV, it’s essential to grant the appropriate permissions to ensure secure and controlled access. You can authorize access for different entities, such as user principals, service principals, or managed identities, depending on your specific scenarios. In this tutorial, the access are authorized to a signed-in Azure user.
101
105
102
-
- `Create` permissions for certificates
103
-
- `Get` permissions for certificates
104
-
- `Sign` permissions for keys
106
+
### Authorize access to ACR
105
107
106
-
In this tutorial, the access policy is assigned to a signed-in Azure user. To learn more about assigning policy to a principal, see [Assign Access Policy](/azure/key-vault/general/assign-access-policy).
108
+
The `AcrPull` and `AcrPush` roles are required for signing container images in ACR.
107
109
108
-
### Set the subscription that contains the AKV resource
110
+
1. Set the subscription that contains the ACR resource
109
111
110
112
```bash
111
-
az account set --subscription <your_subscription_id>
113
+
az account set --subscription $ACR_SUB_ID
112
114
```
113
115
114
-
### Set the access policy in AKV
116
+
2. Assign the roles
117
+
118
+
```bash
119
+
USER_ID=$(az ad signed-in-user show --query id -o tsv)
120
+
az role assignment create --role "AcrPull" --role "AcrPush" --assignee $USER_ID --scope "/subscriptions/$ACR_SUB_ID/resourceGroups/$ACR_RG/providers/Microsoft.ContainerRegistry/registries/$ACR_NAME"
121
+
```
122
+
123
+
### Authorize access to AKV
124
+
125
+
In this section, we’ll explore two options for authorizing access to AKV.
126
+
127
+
#### Use Azure RBAC (Recommended)
128
+
129
+
The following roles are required for signing using self-signed certificates:
130
+
131
+
- `Key Vault Certificates Officer` for creating and reading certificates
0 commit comments