Skip to content

Commit 0ffcd7a

Browse files
authored
Merge pull request #216550 from juliakm/users/jukullam/update-for-oidc-includes
Update to reference newer GitHub secrets UI navigation
2 parents 43d4116 + a43bf3c commit 0ffcd7a

12 files changed

+28
-332
lines changed

articles/aks/kubernetes-action.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ The following shows an example output from the above command.
9595
```
9696

9797
In your GitHub repository, create the below secrets for your action to use. To create a secret:
98-
1. Navigate to the repository's settings, and click *Secrets* then *Actions*.
99-
1. For each secret, click *New Repository Secret* and enter the name and value of the secret.
98+
1. Navigate to the repository's settings, and select **Security > Secrets and variables > Actions**.
99+
1. For each secret, click **New Repository Secret** and enter the name and value of the secret.
100100

101101
For more details on creating secrets, see [Encrypted Secrets][github-actions-secrets].
102102

articles/app-service/app-service-sql-asp-github-actions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ In the example, replace the placeholders with your subscription ID, resource gro
6969

7070
## Configure the GitHub secret for authentication
7171

72-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
73-
74-
To use [user-level credentials](#generate-deployment-credentials), paste the entire JSON output from the Azure CLI command into the secret's value field. Name the secret `AZURE_CREDENTIALS`.
72+
[!INCLUDE [include](~/articles/reusable-content/github-actions/create-secrets-service-principal.md)]
7573

7674
## Add GitHub secrets for your build
7775

articles/app-service/app-service-sql-github-actions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ In the example, replace the placeholders with your subscription ID, resource gro
7070
7171
## Configure the GitHub secret for authentication
7272

73-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
74-
75-
To use [user-level credentials](#generate-deployment-credentials), paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name `AZURE_CREDENTIALS`.
73+
[!INCLUDE [include](~/articles/reusable-content/github-actions/create-secrets-service-principal.md)]
7674

7775
## Add a SQL Server secret
7876

articles/app-service/deploy-container-github-action.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ OpenID Connect is an authentication method that uses short-lived tokens. Setting
126126
127127
# [Publish profile](#tab/publish-profile)
128128
129-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
129+
In [GitHub](https://github.com/), browse your repository. Select **Settings > Security > Secrets and variables > Actions > New repository secret**.
130130
131131
To use [app-level credentials](#generate-deployment-credentials), paste the contents of the downloaded publish profile file into the secret's value field. Name the secret `AZURE_WEBAPP_PUBLISH_PROFILE`.
132132
@@ -140,7 +140,7 @@ When you configure your GitHub workflow, you use the `AZURE_WEBAPP_PUBLISH_PROFI
140140

141141
# [Service principal](#tab/service-principal)
142142

143-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
143+
In [GitHub](https://github.com/), browse your repository. Select **Settings > Security > Secrets and variables > Actions > New repository secret**.
144144

145145
To use [user-level credentials](#generate-deployment-credentials), paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name like `AZURE_CREDENTIALS`.
146146

@@ -156,7 +156,7 @@ When you configure the workflow file later, you use the secret for the input `cr
156156
157157
You need to provide your application's **Client ID**, **Tenant ID** and **Subscription ID** to the login action. These values can either be provided directly in the workflow or can be stored in GitHub secrets and referenced in your workflow. Saving the values as GitHub secrets is the more secure option.
158158
159-
1. Open your GitHub repository and go to **Settings**.
159+
1. Open your GitHub repository and go to **Settings > Security > Secrets and variables > Actions > New repository secret**.
160160
161161
1. Create secrets for `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_SUBSCRIPTION_ID`. Use these values from your Active Directory application for your GitHub secrets. You can find these values in the Azure portal by searching for your active directory application.
162162

articles/app-service/deploy-github-actions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ To learn how to create a Create an active directory application, service princip
160160
161161
# [Publish profile](#tab/applevel)
162162
163-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
163+
In [GitHub](https://github.com/), browse your repository. Select **Settings > Security > Secrets and variables > Actions > New repository secret**.
164164
165165
To use [app-level credentials](#generate-deployment-credentials), paste the contents of the downloaded publish profile file into the secret's value field. Name the secret `AZURE_WEBAPP_PUBLISH_PROFILE`.
166166
@@ -174,7 +174,7 @@ When you configure your GitHub workflow, you use the `AZURE_WEBAPP_PUBLISH_PROFI
174174

175175
# [Service principal](#tab/userlevel)
176176

177-
In [GitHub](https://github.com/), browse your repository, select **Settings > Secrets > Add a new secret**.
177+
In [GitHub](https://github.com/), browse your repository. Select **Settings > Security > Secrets and variables > Actions > New repository secret**.
178178

179179
To use [user-level credentials](#generate-deployment-credentials), paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name `AZURE_CREDENTIALS`.
180180

@@ -190,7 +190,7 @@ When you configure the workflow file later, you use the secret for the input `cr
190190
191191
You need to provide your application's **Client ID**, **Tenant ID** and **Subscription ID** to the login action. These values can either be provided directly in the workflow or can be stored in GitHub secrets and referenced in your workflow. Saving the values as GitHub secrets is the more secure option.
192192
193-
1. Open your GitHub repository and go to **Settings**.
193+
1. Open your GitHub repository and go to **Settings > Security > Secrets and variables > Actions > New repository secret**.
194194
195195
1. Create secrets for `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_SUBSCRIPTION_ID`. Use these values from your Active Directory application for your GitHub secrets:
196196

articles/azure-functions/functions-how-to-github-actions.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ To download the publishing profile of your function app:
4848

4949
### Add the GitHub secret
5050

51-
1. In [GitHub](https://github.com), browse to your repository, select **Settings** > **Secrets** > **Add a new secret**.
51+
1. In [GitHub](https://github.com/), go to your repository.
5252

53-
:::image type="content" source="media/functions-how-to-github-actions/add-secret.png" alt-text="Add Secret":::
53+
1. Select **Security > Secrets and variables > Actions**.
5454

55-
1. Add a new secret using `AZURE_FUNCTIONAPP_PUBLISH_PROFILE` for **Name**, the content of the publishing profile file for **Value**, and then select **Add secret**.
55+
1. Select **New repository secret**.
56+
57+
1. Add a new secret with the name `AZURE_FUNCTIONAPP_PUBLISH_PROFILE` and the value set to the contents of the publishing profile file.
58+
59+
1. Select **Add secret**.
5660

5761
GitHub can now authenticate to your function app in Azure.
5862

articles/azure-resource-manager/bicep/deploy-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Create secrets for your Azure credentials, resource group, and subscriptions.
111111
112112
1. In [GitHub](https://github.com/), navigate to your repository.
113113
114-
1. Select **Settings > Secrets > New secret**.
114+
1. Select **Security > Secrets and variables > Actions > New repository secret**.
115115
116116
1. Paste the entire JSON output from the Azure CLI command into the secret's value field. Name the secret `AZURE_CREDENTIALS`.
117117

articles/azure-resource-manager/templates/deploy-github-actions.md

Lines changed: 2 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -32,120 +32,12 @@ The file has two sections:
3232

3333
## Generate deployment credentials
3434

35-
# [Service principal](#tab/userlevel)
35+
[!INCLUDE [include](~/articles/reusable-content/github-actions/generate-deployment-credentials.md)]
3636

37-
You can create a [service principal](../../active-directory/develop/app-objects-and-service-principals.md#service-principal-object) with the [az ad sp create-for-rbac](/cli/azure/ad/sp#az-ad-sp-create-for-rbac) command in the [Azure CLI](/cli/azure/). Run this command with [Azure Cloud Shell](https://shell.azure.com/) in the Azure portal or by selecting the **Try it** button.
38-
39-
Create a resource group if you do not already have one.
40-
41-
```azurecli-interactive
42-
az group create -n {MyResourceGroup} -l {location}
43-
```
44-
45-
Replace the placeholder `myApp` with the name of your application.
46-
47-
```azurecli-interactive
48-
az ad sp create-for-rbac --name {myApp} --role contributor --scopes /subscriptions/{subscription-id}/resourceGroups/{MyResourceGroup} --sdk-auth
49-
```
50-
51-
In the example above, replace the placeholders with your subscription ID and resource group name. The output is a JSON object with the role assignment credentials that provide access to your App Service app similar to below. Copy this JSON object for later. You will only need the sections with the `clientId`, `clientSecret`, `subscriptionId`, and `tenantId` values.
52-
53-
```output
54-
{
55-
"clientId": "<GUID>",
56-
"clientSecret": "<GUID>",
57-
"subscriptionId": "<GUID>",
58-
"tenantId": "<GUID>",
59-
(...)
60-
}
61-
```
62-
63-
> [!IMPORTANT]
64-
> It is always a good practice to grant minimum access. The scope in the previous example is limited to the resource group.
65-
66-
# [OpenID Connect](#tab/openid)
67-
68-
69-
OpenID Connect is an authentication method that uses short-lived tokens. Setting up [OpenID Connect with GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) is more complex process that offers hardened security.
70-
71-
1. If you do not have an existing application, register a [new Active Directory application and service principal that can access resources](../../active-directory/develop/howto-create-service-principal-portal.md). Create the Active Directory application.
72-
73-
```azurecli-interactive
74-
az ad app create --display-name myApp
75-
```
76-
77-
This command will output JSON with an `appId` that is your `client-id`. Save the value to use as the `AZURE_CLIENT_ID` GitHub secret later.
78-
79-
You'll use the `objectId` value when creating federated credentials with Graph API and reference it as the `APPLICATION-OBJECT-ID`.
80-
81-
1. Create a service principal. Replace the `$appID` with the appId from your JSON output.
82-
83-
This command generates JSON output with a different `objectId` and will be used in the next step. The new `objectId` is the `assignee-object-id`.
84-
85-
Copy the `appOwnerTenantId` to use as a GitHub secret for `AZURE_TENANT_ID` later.
86-
87-
```azurecli-interactive
88-
az ad sp create --id $appId
89-
```
90-
91-
1. Create a new role assignment by subscription and object. By default, the role assignment will be tied to your default subscription. Replace `$subscriptionId` with your subscription ID, `$resourceGroupName` with your resource group name, and `$assigneeObjectId` with the generated `assignee-object-id`. Learn [how to manage Azure subscriptions with the Azure CLI](/cli/azure/manage-azure-subscriptions-azure-cli).
92-
93-
```azurecli-interactive
94-
az role assignment create --role contributor --subscription $subscriptionId --assignee-object-id $assigneeObjectId --assignee-principal-type ServicePrincipal --scopes /subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Web/sites/
95-
```
96-
97-
1. Run the following command to [create a new federated identity credential](/graph/api/application-post-federatedidentitycredentials?view=graph-rest-beta&preserve-view=true) for your active directory application.
98-
99-
* Replace `APPLICATION-OBJECT-ID` with the **objectId (generated while creating app)** for your Active Directory application.
100-
* Set a value for `CREDENTIAL-NAME` to reference later.
101-
* Set the `subject`. The value of this is defined by GitHub depending on your workflow:
102-
* Jobs in your GitHub Actions environment: `repo:< Organization/Repository >:environment:< Name >`
103-
* For Jobs not tied to an environment, include the ref path for branch/tag based on the ref path used for triggering the workflow: `repo:< Organization/Repository >:ref:< ref path>`. For example, `repo:n-username/ node_express:ref:refs/heads/my-branch` or `repo:n-username/ node_express:ref:refs/tags/my-tag`.
104-
* For workflows triggered by a pull request event: `repo:< Organization/Repository >:pull_request`.
105-
106-
```azurecli
107-
az rest --method POST --uri 'https://graph.microsoft.com/beta/applications/<APPLICATION-OBJECT-ID>/federatedIdentityCredentials' --body '{"name":"<CREDENTIAL-NAME>","issuer":"https://token.actions.githubusercontent.com","subject":"repo:organization/repository:ref:refs/heads/main","description":"Testing","audiences":["api://AzureADTokenExchange"]}'
108-
```
109-
110-
To learn how to create a Create an active directory application, service principal, and federated credentials in Azure portal, see [Connect GitHub and Azure](/azure/developer/github/connect-from-azure#use-the-azure-login-action-with-openid-connect).
111-
112-
113-
---
11437
## Configure the GitHub secrets
11538

116-
# [Service principal](#tab/userlevel)
117-
118-
You need to create secrets for your Azure credentials, resource group, and subscriptions.
119-
120-
1. In [GitHub](https://github.com/), browse your repository.
121-
122-
1. Select **Settings > Secrets > New secret**.
123-
124-
1. Paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name `AZURE_CREDENTIALS`.
39+
[!INCLUDE [include](~/articles/reusable-content/github-actions/create-secrets-with-openid.md)]
12540

126-
1. Create another secret named `AZURE_RG`. Add the name of your resource group to the secret's value field (example: `myResourceGroup`).
127-
128-
1. Create an additional secret named `AZURE_SUBSCRIPTION`. Add your subscription ID to the secret's value field (example: `90fd3f9d-4c61-432d-99ba-1273f236afa2`).
129-
130-
# [OpenID Connect](#tab/openid)
131-
132-
You need to provide your application's **Client ID**, **Tenant ID**, and **Subscription ID** to the login action. These values can either be provided directly in the workflow or can be stored in GitHub secrets and referenced in your workflow. Saving the values as GitHub secrets is the more secure option.
133-
134-
1. Open your GitHub repository and go to **Settings**.
135-
136-
1. Select **Settings > Secrets > New secret**.
137-
138-
1. Create secrets for `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_SUBSCRIPTION_ID`. Use these values from your Active Directory application for your GitHub secrets:
139-
140-
|GitHub Secret | Active Directory Application |
141-
|---------|---------|
142-
|AZURE_CLIENT_ID | Application (client) ID |
143-
|AZURE_TENANT_ID | Directory (tenant) ID |
144-
|AZURE_SUBSCRIPTION_ID | Subscription ID |
145-
146-
1. Save each secret by selecting **Add secret**.
147-
148-
---
14941
## Add Resource Manager template
15042

15143
Add a Resource Manager template to your GitHub repository. This template creates a storage account.

articles/container-instances/container-instances-github-action.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ az role assignment create \
112112

113113
### Save credentials to GitHub repo
114114

115-
1. In the GitHub UI, navigate to your forked repository and select **Settings** > **Secrets** > **Actions**.
115+
1. In the GitHub UI, navigate to your forked repository and select **Security > Secrets and variables > Actions**.
116116

117117
1. Select **New repository secret** to add the following secrets:
118118

articles/container-registry/github-action-scan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ In this example, you'll create a three secrets that you can use to authenticate
4848

4949
:::image type="content" source="media/github-action-scan/github-repo-settings.png" alt-text="Select Settings in the navigation.":::
5050

51-
1. Select **Secrets** and then **New Secret**.
51+
1. Select **Security > Secrets and variables > Actions**.
5252

53-
:::image type="content" source="media/github-action-scan/azure-secret-add.png" alt-text="Choose to add a secret.":::
53+
1. Select **New repository secret**.
5454

5555
1. Paste the following values for each secret created with the following values from the Azure portal by navigating to the **Access Keys** in the Container Registry.
5656

0 commit comments

Comments
 (0)