Skip to content

Commit ba92b42

Browse files
authored
Merge pull request #102052 from FeynmanZhou/main
Update container-registry-oras-artifacts.md and container-registry-oci-artifacts.md
2 parents b826d75 + 4b2c330 commit ba92b42

File tree

3 files changed

+75
-37
lines changed

3 files changed

+75
-37
lines changed

articles/container-registry/container-registry-oci-artifacts.md

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,15 @@ To demonstrate this capability, this article shows how to use the [OCI Registry
1717
## Prerequisites
1818

1919
* **Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI](container-registry-get-started-azure-cli.md).
20-
* **ORAS tool** - Download and install a current ORAS release for your operating system from the [GitHub repo](https://github.com/deislabs/oras/releases). The tool is released as a compressed tarball (`.tar.gz` file). Extract and install the file using standard procedures for your operating system.
20+
* **ORAS tool** - Download and install ORAS CLI v0.16.0 for your operating system from the [ORAS installation guide](https://oras.land/cli/).
2121
* **Azure Active Directory service principal (optional)** - To authenticate directly with ORAS, create a [service principal](container-registry-auth-service-principal.md) to access your registry. Ensure that the service principal is assigned a role such as AcrPush so that it has permissions to push and pull artifacts.
2222
* **Azure CLI (optional)** - To use an individual identity, you need a local installation of the Azure CLI. Version 2.0.71 or later is recommended. Run `az --version `to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
2323
* **Docker (optional)** - To use an individual identity, you must also have Docker installed locally, to authenticate with the registry. Docker provides packages that easily configure Docker on any [macOS][docker-mac], [Windows][docker-windows], or [Linux][docker-linux] system.
2424

2525

2626
## Sign in to a registry
2727

28-
This section shows two suggested workflows to sign into the registry, depending on the identity used. Choose the method appropriate for your environment.
29-
30-
### Sign in with ORAS
31-
32-
Using a [service principal](container-registry-auth-service-principal.md) with push rights, run the `oras login` command to sign in to the registry using the service principal application ID and password. Specify the fully qualified registry name (all lowercase), in this case *myregistry.azurecr.io*. The service principal application ID is passed in the environment variable `$SP_APP_ID`, and the password in the variable `$SP_PASSWD`.
33-
34-
```bash
35-
oras login myregistry.azurecr.io --username $SP_APP_ID --password $SP_PASSWD
36-
```
37-
38-
To read the password from Stdin, use `--password-stdin`.
28+
This section shows two suggested workflows to sign into the registry, depending on the identity used. Choose the one of the two methods below appropriate for your environment.
3929

4030
### Sign in with Azure CLI
4131

@@ -51,6 +41,52 @@ az acr login --name myregistry
5141
> [!NOTE]
5242
> `az acr login` uses the Docker client to set an Azure Active Directory token in the `docker.config` file. The Docker client must be installed and running to complete the individual authentication flow.
5343
44+
### Sign in with ORAS
45+
46+
This section shows options to sign into the registry. Choose one method below appropriate for your environment.
47+
48+
Run `oras login` to authenticate with the registry. You may pass [registry credentials](container-registry-authentication.md) appropriate for your scenario, such as service principal credentials, user identity, or a repository-scoped token (preview).
49+
50+
- Authenticate with your [individual Azure AD identity](container-registry-authentication.md?tabs=azure-cli#individual-login-with-azure-ad) to use an AD token. Always use "000..." as the token is parsed through the `PASSWORD` variable.
51+
52+
```azurecli
53+
USER_NAME="00000000-0000-0000-0000-000000000000"
54+
PASSWORD=$(az acr login --name $ACR_NAME --expose-token --output tsv --query accessToken)
55+
```
56+
57+
- Authenticate with a [repository scoped token](container-registry-repository-scoped-permissions.md) (Preview) to use non-AD based tokens.
58+
59+
```azurecli
60+
USER_NAME="oras-token"
61+
PASSWORD=$(az acr token create -n $USER_NAME \
62+
-r $ACR_NAME \
63+
--repository $REPO content/write \
64+
--only-show-errors \
65+
--query "credentials.passwords[0].value" -o tsv)
66+
```
67+
68+
- Authenticate with an Azure Active Directory [service principal with pull and push permissions](container-registry-auth-service-principal.md#create-a-service-principal) (AcrPush role) to the registry.
69+
70+
```azurecli
71+
SERVICE_PRINCIPAL_NAME="oras-sp"
72+
ACR_REGISTRY_ID=$(az acr show --name $ACR_NAME --query id --output tsv)
73+
PASSWORD=$(az ad sp create-for-rbac --name $SERVICE_PRINCIPAL_NAME \
74+
--scopes $(az acr show --name $ACR_NAME --query id --output tsv) \
75+
--role acrpush \
76+
--query "password" --output tsv)
77+
USER_NAME=$(az ad sp list --display-name $SERVICE_PRINCIPAL_NAME --query "[].appId" --output tsv)
78+
```
79+
80+
Supply the credentials to `oras login` after authentication configured.
81+
82+
```bash
83+
oras login $REGISTRY \
84+
--username $USER_NAME \
85+
--password $PASSWORD
86+
```
87+
88+
To read the password from Stdin, use `--password-stdin`.
89+
5490
## Push an artifact
5591

5692
Create a text file in a local working working directory with some sample text. For example, in a bash shell:
@@ -65,15 +101,15 @@ Use the `oras push` command to push this text file to your registry. The followi
65101

66102
```bash
67103
oras push myregistry.azurecr.io/samples/artifact:1.0 \
68-
--manifest-config /dev/null:application/vnd.unknown.config.v1+json \
104+
--config /dev/null:application/vnd.unknown.v1\
69105
./artifact.txt:application/vnd.unknown.layer.v1+txt
70106
```
71107

72108
**Windows**
73109

74110
```cmd
75111
.\oras.exe push myregistry.azurecr.io/samples/artifact:1.0 ^
76-
--manifest-config NUL:application/vnd.unknown.config.v1+json ^
112+
--config NUL:application/vnd.unknown.v1 ^
77113
.\artifact.txt:application/vnd.unknown.layer.v1+txt
78114
```
79115

@@ -124,8 +160,7 @@ rm artifact.txt
124160
Run `oras pull` to pull the artifact, and specify the media type used to push the artifact:
125161

126162
```bash
127-
oras pull myregistry.azurecr.io/samples/artifact:1.0 \
128-
--media-type application/vnd.unknown.layer.v1+txt
163+
oras pull myregistry.azurecr.io/samples/artifact:1.0
129164
```
130165

131166
Verify that the pull was successful:

articles/container-registry/container-registry-oras-artifacts.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ ms.custom: references_regions, devx-track-azurecli
1111

1212
# Push and pull supply chain artifacts using Azure Registry (Preview)
1313

14-
Use an Azure container registry to store and manage a graph of artifacts, including signatures, software bill of materials (SBoM), security scan results or other types.
14+
Use an Azure container registry to store and manage a graph of supply chain artifacts along side container images, including signatures, software bill of materials (SBoM), security scan results or other types.
1515

1616
![Graph of artifacts, including a container image, signature and signed software bill of materials](./media/container-registry-artifacts/oras-artifact-graph.svg)
1717

18-
To demonstrate this capability, this article shows how to use the [OCI Registry as Storage (ORAS)](https://oras.land) tool to push and pull a graph of artifacts to an Azure container registry.
18+
To demonstrate this capability, this article shows how to use the [OCI Registry as Storage (ORAS)](https://oras.land) tool to push and pull a graph of supply chain artifacts to an Azure container registry.
1919

20-
ORAS Artifacts support is a preview feature and subject to [limitations](#preview-limitations). It requires [zone redundancy](zone-redundancy.md), which is available in the Premium service tier. For information about registry service tiers and limits, see [Azure Container Registry service tiers](container-registry-skus.md).
20+
Supply chain artifact is a type of [OCI Artifact Manifest][oci-artifact-manifest]. OCI Artifact Manifest support is a preview feature and subject to [limitations](#preview-limitations).
2121

2222
## Prerequisites
2323

24-
* **ORAS CLI** - The ORAS CLI enables attach, copy, push, discover, pull of artifacts to an ORAS Artifacts enabled registry.
24+
* **ORAS CLI** - The ORAS CLI enables attach, copy, push, discover, pull of artifacts to an OCI Artifact Manifest enabled registry.
2525
* **Azure CLI** - To create an identity, list and delete repositories, you need a local installation of the Azure CLI. Version 2.29.1 or later is recommended. Run `az --version `to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
2626
* **Docker (optional)** - To complete the walkthrough, a container image is referenced. You can use Docker installed locally to build and push a container image, or reference an existing container image. Docker provides packages that easily configure Docker on any [macOS][docker-mac], [Windows][docker-windows], or [Linux][docker-linux] system.
2727

2828
## Preview limitations
2929

30-
ORAS Artifacts support is not available in the government or China clouds, but available in all other regions.
30+
OCI Artifact Manifest support is not available in the government or China clouds, but available in all other regions.
3131

3232
## ORAS installation
3333

34-
Download and install a preview ORAS release for your operating system. See [ORAS installation instructions][oras-install-docs] for how to extract and install the file for your operating system. This article uses ORAS CLI 0.14.1 to demonstrate how to manage supply chain artifacts in ACR.
34+
Download and install a preview ORAS release for your operating system. See [ORAS installation instructions][oras-install-docs] for how to extract and install ORAS for your operating system. This article uses ORAS CLI 0.16.0 to demonstrate how to manage supply chain artifacts in ACR.
3535

3636
## Configure a registry
3737

@@ -52,9 +52,9 @@ If needed, run the [az group create](/cli/azure/group#az-group-create) command t
5252
```azurecli
5353
az group create --name $ACR_NAME --location southcentralus
5454
```
55-
### Create ORAS Artifact enabled registry
55+
### Create OCI Artifact Manifest enabled registry
5656

57-
Preview support for ORAS Artifacts requires Zone Redundancy, which requires a Premium service tier, in the South Central US region. Run the [az acr create](/cli/azure/acr#az-acr-create) command to create an ORAS Artifacts enabled registry. See the `az acr create` command help for more registry options.
57+
Preview support for OCI Artifact Manifest requires Zone Redundancy, which requires a Premium service tier, in the South Central US region. Run the [az acr create](/cli/azure/acr#az-acr-create) command to create an OCI Artifact Manifest enabled registry. See the `az acr create` command help for more registry options.
5858

5959
```azurecli
6060
az acr create \
@@ -65,7 +65,7 @@ az acr create \
6565
--output jsonc
6666
```
6767

68-
In the command output, note the `zoneRedundancy` property for the registry. When enabled, the registry is zone redundant, and ORAS Artifact enabled.
68+
In the command output, note the `zoneRedundancy` property for the registry. When enabled, the registry is zone redundant, and OCI Artifact Manifest enabled.
6969

7070
```output
7171
{
@@ -177,13 +177,13 @@ Attach the multi-file artifact as a reference.
177177
```bash
178178
oras attach $IMAGE \
179179
./readme.md:application/markdown \
180-
./readme-details.md:application/markdown
180+
./readme-details.md:application/markdown \
181181
--artifact-type readme/example
182182
```
183183

184184
## Discovering artifact references
185185

186-
The ORAS Artifacts Specification defines a [referrers API][oras-artifacts-referrers] for discovering references to a `subject` artifact. The `oras discover` command can show the list of references to the container image.
186+
The [OCI v1.1 Specification][oci-spec] defines a [referrers API][oci-artifacts-referrers] for discovering references to a `subject` artifact. The `oras discover` command can show the list of references to the container image.
187187

188188
Using `oras discover`, view the graph of artifacts now stored in the registry.
189189

@@ -203,7 +203,7 @@ myregistry.azurecr.io/net-monitor:v1
203203

204204
## Creating a deep graphs of artifacts
205205

206-
The ORAS Artifacts specification enables deep graphs, enabling signed software bill of materials (SBoM) and other artifact types.
206+
The OCI v1.1 Specification enables deep graphs, enabling signed software bill of materials (SBoM) and other artifact types.
207207

208208
### Create a sample SBoM
209209

@@ -226,7 +226,7 @@ Artifacts that are pushed as references, typically do not have tags as they are
226226
```bash
227227
SBOM_DIGEST=$(oras discover -o json \
228228
--artifact-type sbom/example \
229-
$IMAGE | jq -r ".referrers[0].digest")
229+
$IMAGE | jq -r ".manifests[0].digest")
230230
```
231231

232232
Create a signature of an SBoM
@@ -270,7 +270,7 @@ To pull a referenced type, the digest of reference is discovered with the `oras
270270
```bash
271271
DOC_DIGEST=$(oras discover -o json \
272272
--artifact-type 'readme/example' \
273-
$IMAGE | jq -r ".referrers[0].digest")
273+
$IMAGE | jq -r ".manifests[0].digest")
274274
```
275275

276276
### Create a clean directory for downloading
@@ -291,7 +291,7 @@ ls ./download
291291

292292
## View the repository and tag listing
293293

294-
ORAS Artifacts enables artifact graphs to be pushed, discovered, pulled and copied without having to assign tags. This enables a tag listing to focus on the artifacts users think about, as opposed to the signatures and SBoMs that are associated with the container images, helm charts and other artifacts.
294+
OCI Artifact Manifest enables artifact graphs to be pushed, discovered, pulled and copied without having to assign tags. This enables a tag listing to focus on the artifacts users think about, as opposed to the signatures and SBoMs that are associated with the container images, helm charts and other artifacts.
295295

296296
### View a list of tags
297297

@@ -356,7 +356,7 @@ The signature is untagged, but tracked as a `oras.artifact.manifest` reference t
356356
```
357357
## Delete all artifacts in the graph
358358

359-
Support for the ORAS Artifacts specification enables deleting the graph of artifacts associated with the root artifact. Use the [az acr repository delete][az-acr-repository-delete] command to delete the signature, SBoM and the signature of the SBoM.
359+
Support for the OCI v1.1 Specification enables deleting the graph of artifacts associated with the root artifact. Use the [az acr repository delete][az-acr-repository-delete] command to delete the signature, SBoM and the signature of the SBoM.
360360

361361
```azurecli
362362
az acr repository delete \
@@ -376,15 +376,18 @@ az acr manifest list-metadata \
376376
## Next steps
377377

378378
* Learn more about [the ORAS CLI](https://oras.land/cli/)
379-
* Learn more about [ORAS Artifacts][oras-artifacts] for how to push, discover, pull, copy a graph of supply chain artifacts
379+
* Learn more about [OCI Artifact Manifest][oci-artifact-manifest] for how to push, discover, pull, copy a graph of supply chain artifacts
380380

381381
<!-- LINKS - external -->
382382
[docker-linux]: https://docs.docker.com/engine/installation/#supported-platforms
383383
[docker-mac]: https://docs.docker.com/docker-for-mac/
384384
[docker-windows]: https://docs.docker.com/docker-for-windows/
385385
[oras-install-docs]: https://oras.land/cli/
386386
[oras-docs]: https://oras.land/
387-
[oras-artifacts]: https://github.com/oras-project/artifacts-spec/
387+
[oci-artifacts-referrers]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers/
388+
[oci-artifact-manifest]: https://github.com/opencontainers/image-spec/blob/main/artifact.md/
389+
[oci-spec]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md/
390+
388391
<!-- LINKS - internal -->
389392
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
390393
[az-acr-repository-delete]: /cli/azure/acr/repository#az_acr_repository_delete

articles/container-registry/media/container-registry-artifacts/oras-artifact-graph.svg

Lines changed: 3 additions & 3 deletions
Loading

0 commit comments

Comments
 (0)