Skip to content

Commit 198023c

Browse files
authored
Merge pull request #184087 from MicrosoftDocs/master
1/04 AM Publish
2 parents 084db80 + bb5da29 commit 198023c

File tree

50 files changed

+732
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+732
-112
lines changed

articles/active-directory/saas-apps/workplace-by-facebook-provisioning-tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ This section guides you through the steps to configure the Azure AD provisioning
8888

8989
![Screenshot of the Provisioning Mode dropdown list with the Automatic option called out.](common/provisioning-automatic.png)
9090

91-
5. Under the **Admin Credentials** section, click on **Authorize**. You'll be redirected to Workplace by Facebook's authorization page. Input your Workplace by Facebook username and click on the **Continue** button. Click **Test Connection** to ensure Azure AD can connect to Workplace by Facebook. If the connection fails, ensure your Workplace by Facebook account has Admin permissions and try again.
91+
5. Ensure the "Tenant URL" section is populated with the correct endpoint: https://scim.workplace.com/ .Under the **Admin Credentials** section, click on **Authorize**. You'll be redirected to Workplace by Facebook's authorization page. Input your Workplace by Facebook username and click on the **Continue** button. Click **Test Connection** to ensure Azure AD can connect to Workplace by Facebook. If the connection fails, ensure your Workplace by Facebook account has Admin permissions and try again.
9292

9393
![Screenshot shows Admin Credentials dialog box with an Authorize option.](./media/workplace-by-facebook-provisioning-tutorial/provisionings.png)
9494

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

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Custom container CI/CD from GitHub Actions
33
description: Learn how to use GitHub Actions to deploy your custom Linux container to App Service from a CI/CD pipeline.
44
ms.topic: article
5-
ms.date: 12/04/2020
5+
ms.date: 12/15/2021
66
ms.author: jafreebe
77
ms.reviewer: ushan
88
ms.custom: github-actions-azure
@@ -32,7 +32,7 @@ For an Azure App Service container workflow, the file has three sections:
3232

3333
## Generate deployment credentials
3434

35-
The recommended way to authenticate with Azure App Services for GitHub Actions is with a publish profile. You can also authenticate with a service principal but the process requires more steps.
35+
The recommended way to authenticate with Azure App Services for GitHub Actions is with a publish profile. You can also authenticate with a service principal or Open ID Connect but the process requires more steps.
3636

3737
Save your publish profile credential or service principal as a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets) to authenticate with Azure. You'll access the secret within your workflow.
3838

@@ -74,6 +74,52 @@ In the example, replace the placeholders with your subscription ID, resource gro
7474
> [!IMPORTANT]
7575
> It is always a good practice to grant minimum access. The scope in the previous example is limited to the specific App Service app and not the entire resource group.
7676
77+
# [OpenID Connect](#tab/openid)
78+
79+
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.
80+
81+
1. If you do not have an existing application, register a [new Active Directory application and service principal that can access resources](/azure/active-directory/develop/howto-create-service-principal-portal). Create the Active Directory application.
82+
83+
```azurecli-interactive
84+
az ad app create --display-name myApp
85+
```
86+
87+
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.
88+
89+
You'll use the `objectId` value when creating federated credentials with Graph API and reference it as the `APPLICATION-OBJECT-ID`.
90+
91+
1. Create a service principal. Replace the `$appID` with the appId from your JSON output.
92+
93+
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`.
94+
95+
Copy the `appOwnerTenantId` to use as a GitHub secret for `AZURE_TENANT_ID` later.
96+
97+
```azurecli-interactive
98+
az ad sp create --id $appId
99+
```
100+
101+
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 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).
102+
103+
```azurecli-interactive
104+
az role assignment create --role contributor --subscription $subscriptionId --assignee-object-id $assigneeObjectId --assignee-principal-type ServicePrincipal
105+
```
106+
107+
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.
108+
109+
* Replace `APPLICATION-OBJECT-ID` with the **objectId (generated while creating app)** for your Active Directory application.
110+
* Set a value for `CREDENTIAL-NAME` to reference later.
111+
* Set the `subject`. The value of this is defined by GitHub depending on your workflow:
112+
* Jobs in your GitHub Actions environment: `repo:< Organization/Repository >:environment:< Name >`
113+
* 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`.
114+
* For workflows triggered by a pull request event: `repo:< Organization/Repository >:pull_request`.
115+
116+
```azurecli
117+
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"]}'
118+
```
119+
120+
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).
121+
122+
77123
---
78124
## Configure the GitHub secret for authentication
79125

@@ -104,6 +150,21 @@ When you configure the workflow file later, you use the secret for the input `cr
104150
with:
105151
creds: ${{ secrets.AZURE_CREDENTIALS }}
106152
```
153+
# [OpenID Connect](#tab/openid)
154+
155+
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.
156+
157+
1. Open your GitHub repository and go to **Settings**.
158+
159+
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.
160+
161+
|GitHub Secret | Active Directory Application |
162+
|---------|---------|
163+
|AZURE_CLIENT_ID | Application (client) ID |
164+
|AZURE_TENANT_ID | Directory (tenant) ID |
165+
|AZURE_SUBSCRIPTION_ID | Subscription ID |
166+
167+
1. Save each secret by selecting **Add secret**.
107168

108169
---
109170

@@ -254,6 +315,49 @@ jobs:
254315
az logout
255316
```
256317

318+
# [OpenID Connect](#tab/openid)
319+
320+
```yaml
321+
on: [push]
322+
name: Linux_Container_Node_Workflow
323+
324+
permissions:
325+
id-token: write
326+
contents: read
327+
328+
jobs:
329+
build-and-deploy:
330+
runs-on: ubuntu-latest
331+
steps:
332+
# checkout the repo
333+
- name: 'Checkout GitHub Action'
334+
uses: actions/checkout@main
335+
336+
- name: 'Login via Azure CLI'
337+
uses: azure/login@v1
338+
with:
339+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
340+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
341+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
342+
343+
- uses: azure/docker-login@v1
344+
with:
345+
login-server: mycontainer.azurecr.io
346+
username: ${{ secrets.REGISTRY_USERNAME }}
347+
password: ${{ secrets.REGISTRY_PASSWORD }}
348+
- run: |
349+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
350+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
351+
352+
- uses: azure/webapps-deploy@v2
353+
with:
354+
app-name: 'myapp'
355+
images: 'mycontainer.azurecr.io/myapp:${{ github.sha }}'
356+
357+
- name: Azure logout
358+
run: |
359+
az logout
360+
```
257361
---
258362

259363
## Next steps

0 commit comments

Comments
 (0)