Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[azure-docs] refine deployment with ACR docs #26397

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions docs/content/dagster-plus/deployment/azure/acr-user-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,26 @@ First, we'll need to generate a service principal for GitHub Actions to use to a
az ad sp create-for-rbac --name "github-actions-acr" --role contributor --scopes /subscriptions/<your_azure_subscription_id>/resourceGroups/<your_resource_group>/providers/Microsoft.ContainerRegistry/registries/<your_acr_name>
```

This command will output a JSON object with the service principal details. Make sure to save the `appId`, `password`, and `tenant` values - we'll use them in the next step.
This command will output a JSON object with the service principal details. Make sure to save the `appId` and `password` values - we'll use them in the next step.
mlarose marked this conversation as resolved.
Show resolved Hide resolved

### Add secrets to your repository

We'll add the service principal details as secrets in our repository. Go to your repository in GitHub, and navigate to `Settings` -> `Secrets`. Add the following secrets:

- `DAGSTER_CLOUD_API_TOKEN`: An agent token. For more details see [Managing agent tokens](/dagster-plus/account/managing-user-agent-tokens#managing-agent-tokens).
- `AZURE_CLIENT_ID`: The `appId` from the service principal JSON object.
- `AZURE_CLIENT_SECRET`: The `password` from the service principal JSON object.

### Update the workflow
### Update the GitHub Actions workflow

Finally, we'll update the workflow to use the service principal details. Open `.github/workflows/dagster-cloud-deploy.yml` in your repository, and uncomment the section on Azure Container Registry. It should look like this:
For this step, open `.github/workflows/dagster-cloud-deploy.yml` in your repository with your preferred text editor to perform the changes below.

In the `env` section of the workflow, update the following variables:

- `DAGSTER_CLOUD_ORGANIZATION`: The name of your Dagster Cloud organization.
mlarose marked this conversation as resolved.
Show resolved Hide resolved
- `IMAGE_REGISTRY`: The URL of your Azure Container Registry: `<your-acr-name>.azurecr.io`.

We'll update the workflow to use the Azure Container Registry by uncommenting its section and providing the principal details. It should look like this:

```yaml
# Azure Container Registry (ACR)
Expand All @@ -114,6 +122,34 @@ Finally, we'll update the workflow to use the service principal details. Open `.
password: ${{ secrets.AZURE_CLIENT_SECRET }}
```

Finally, update the tags in the "Build and upload Docker image" step to match the full URL of your image in ACR:

```yaml
- name: Build and upload Docker image for "quickstart_etl"
if: steps.prerun.outputs.result != 'skip'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.IMAGE_REGISTRY }}/<image-name>:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
```

### Update the `dagster_cloud.yaml` build configuration to use the Azure Container Registry

Edit the `dagster_cloud.yaml` file in the root of your repository. Update the `build` section to use the Azure Container Registry, and provide an image name specific to the code location. This must match the registry and image name used in the previous step.

```yaml
mlarose marked this conversation as resolved.
Show resolved Hide resolved
locations:
- location_name: quickstart_etl
code_source:
package_name: quickstart_etl.definitions
build:
directory: ./
registry: <your-acr-name>.azurecr.io/<image-name>
```

### Push and run the workflow

Now, commit and push the changes to your repository. The GitHub Actions workflow should run automatically. You can check the status of the workflow in the `Actions` tab of your repository.
Expand Down
Loading