Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions AppCreationScripts/Cleanup.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[CmdletBinding()]
param(
[PSCredential] $Credential,
[Parameter(Mandatory=$False, HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the AzureAD tenant into which you want to create the apps')]
[Parameter(Mandatory=$False, HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the Microsoft Entra tenant into which you want to create the apps')]
[string] $tenantId,
[Parameter(Mandatory=$False, HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
[string] $azureEnvironmentName
)

#Requires -Modules AzureAD
#Requires -Modules Microsoft Entra


if ($null -eq (Get-Module -ListAvailable -Name "AzureAD")) {
Expand All @@ -25,11 +25,11 @@ Function Cleanup

<#
.Description
This function removes the Azure AD applications for the sample. These applications were created by the Configure.ps1 script
This function removes the Microsoft Entra applications for the sample. These applications were created by the Configure.ps1 script
#>

# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the Microsoft Entra tenant
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Microsoft Entra ID.

# Login to Azure PowerShell (interactive if credentials are not already provided:
# you'll need to sign-in with creds enabling your to create apps in the tenant)
Expand Down
30 changes: 15 additions & 15 deletions AppCreationScripts/Configure.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[CmdletBinding()]
param(
[PSCredential] $Credential,
[Parameter(Mandatory=$False, HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the AzureAD tenant into which you want to create the apps')]
[Parameter(Mandatory=$False, HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the Microsoft Entra tenant into which you want to create the apps')]
[string] $tenantId,
[Parameter(Mandatory=$False, HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
[string] $azureEnvironmentName
)

#Requires -Modules AzureAD
#Requires -Modules Microsoft Entra

<#
This script creates the Azure AD applications needed for this sample and updates the configuration files
for the visual Studio projects from the data in the Azure AD applications.
This script creates the Microsoft Entra applications needed for this sample and updates the configuration files
for the visual Studio projects from the data in the Microsoft Entra applications.

Before running this script you need to install the AzureAD cmdlets as an administrator.
Before running this script you need to install the Microsoft EntraD cmdlets as an administrator.
For this:
1) Run Powershell as an administrator
2) in the PowerShell window, type: Install-Module AzureAD
2) in the PowerShell window, type: Install-Module Microsoft Entra

There are four ways to run this script. For more information, read the AppCreationScripts.md file in the same folder as this script.
#>
Expand Down Expand Up @@ -162,7 +162,7 @@ Function UpdateTextFile([string] $configFilePath, [System.Collections.HashTable]
Set-Content -Path $configFilePath -Value $lines -Force
}
<#.Description
This function creates a new Azure AD scope (OAuth2Permission) with default and provided values
This function creates a new Microsoft Entra scope (OAuth2Permission) with default and provided values
#>
Function CreateScope( [string] $value, [string] $userConsentDisplayName, [string] $userConsentDescription, [string] $adminConsentDisplayName, [string] $adminConsentDescription)
{
Expand All @@ -179,7 +179,7 @@ Function CreateScope( [string] $value, [string] $userConsentDisplayName, [string
}

<#.Description
This function creates a new Azure AD AppRole with default and provided values
This function creates a new Microsoft Entra AppRole with default and provided values
#>
Function CreateAppRole([string] $types, [string] $name, [string] $description)
{
Expand All @@ -206,7 +206,7 @@ $ErrorActionPreference = "Stop"
Function ConfigureApplications
{
<#.Description
This function creates the Azure AD applications for the sample in the provided Azure AD tenant and updates the
This function creates the Microsoft Entra applications for the sample in the provided Microsoft Entra tenant and updates the
configuration files in the client and service project of the visual studio solution (App.Config and Web.Config)
so that they are consistent with the Applications parameters
#>
Expand All @@ -217,8 +217,8 @@ Function ConfigureApplications
$azureEnvironmentName = "AzureCloud"
}

# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of theMicrosoft Entra tenant
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Microsoft Entra.

# Login to Azure PowerShell (interactive if credentials are not already provided:
# you'll need to sign-in with creds enabling your to create apps in the tenant)
Expand Down Expand Up @@ -251,7 +251,7 @@ Function ConfigureApplications
# Get the user running the script to add the user as the app owner
$user = Get-AzureADUser -ObjectId $creds.Account.Id

# Create the service AAD application
# Create the service Microsoft Entra application
Write-Host "Creating the AAD application (auther-server-sample-webApi)"
# Get a 2 years application key for the service Application
$pw = ComputePassword
Expand Down Expand Up @@ -313,7 +313,7 @@ Function ConfigureApplications

Write-Host "Done creating the service application auther-server-sample-webApi"

# URL of the AAD application in the Azure portal
# URL of the Microsoft Entra application in the Azure portal
# Future? $servicePortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$serviceAadApplication.AppId+"/objectId/"+$serviceAadApplication.ObjectId+"/isMSAApp/"
$servicePortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$serviceAadApplication.AppId+"/objectId/"+$serviceAadApplication.ObjectId+"/isMSAApp/"
Add-Content -Value "<tr><td>service</td><td>$currentAppId</td><td><a href='$servicePortalUrl'>auther-server-sample-webApi</a></td></tr>" -Path createdApps.html
Expand All @@ -331,7 +331,7 @@ Function ConfigureApplications
Set-AzureADApplication -ObjectId $serviceAadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess
Write-Host "Granted permissions."

# Create the client AAD application
# Create the client Microsoft Entra application
Write-Host "Creating the AAD application auther-server-sample-webClient"
# create the application
$clientAadApplication = New-AzureADApplication -DisplayName "auther-server-sample-webClient" `
Expand All @@ -355,7 +355,7 @@ Function ConfigureApplications

Write-Host "Done creating the client application auther-server-sample-webClient"

# URL of the AAD application in the Azure portal
# URL of the Microsoft Entra application in the Azure portal
# Future? $clientPortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$clientAadApplication.AppId+"/objectId/"+$clientAadApplication.ObjectId+"/isMSAApp/"
$clientPortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$clientAadApplication.AppId+"/objectId/"+$clientAadApplication.ObjectId+"/isMSAApp/"
Add-Content -Value "<tr><td>client</td><td>$currentAppId</td><td><a href='$clientPortalUrl'>\auther-server-sample-webClient</a></td></tr>" -Path createdApps.html
Expand Down
24 changes: 12 additions & 12 deletions AppCreationScripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
```PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
```
3. Make sure to [install Azure Active Directory PowerShell Modules](#install-azuread-powershell-modules)
4. Run the script to create your Azure Active Directory application and configure the code of the sample application accordingly. (Other ways of running the scripts are described below). Please refer to the **sample.json** file to get an overview of changes.
3. Make sure to [install Microsoft Entra PowerShell Modules](#install-azuread-powershell-modules)
4. Run the script to create your Microsoft Entra application and configure the code of the sample application accordingly. (Other ways of running the scripts are described below). Please refer to the **sample.json** file to get an overview of changes.
```PowerShell
cd .\AppCreationScripts\
.\Configure.ps1
Expand All @@ -23,7 +23,7 @@ If you prefer, you can directly go to the following paragraphs:

- [Present the scripts](#presentation-of-the-scripts) and explain their [usage patterns](#usage-pattern-for-tests-and-devops-scenarios) for test and DevOps scenarios.
- Explain the [pre-requisites](#pre-requisites)
- [Install Azure Active Directory PowerShell modules](#install-azuread-powershell-modules)
- [Install Microsoft Entra PowerShell modules](#install-azuread-powershell-modules)
- Explain [four ways of running the scripts](#four-ways-to-run-the-script):
- [Interactively](#option-1-interactive) to create the app in your home tenant
- [Passing credentials](#option-2-non-interactive) to create the app in your home tenant
Expand All @@ -35,23 +35,23 @@ If you prefer, you can directly go to the following paragraphs:

### Presentation of the scripts

This sample comes with two PowerShell scripts, which automate the creation of the Azure Active Directory applications, and the configuration of the code for this sample. Once you run them, you will only need to build the solution and you are good to test.
This sample comes with two PowerShell scripts, which automate the creation of the Microsoft Entra applications, and the configuration of the code for this sample. Once you run them, you will only need to build the solution and you are good to test.

These scripts are:

- `Configure.ps1` which:
- creates Azure Active Directory applications and their related objects (permissions, dependencies, secrets),
- creates Microsoft Entra applications and their related objects (permissions, dependencies, secrets),
- changes the configuration files in the Node.js WebApi and Test MinimalClient JavaScript projects.
- creates a summary file named `createdApps.html` in the folder from which you ran the script, and containing, for each Azure Active Directory application it created:
- creates a summary file named `createdApps.html` in the folder from which you ran the script, and containing, for each Microsoft Entra application it created:
- the identifier of the application
- the AppId of the application
- the url of its registration in the [Azure portal](https://portal.azure.com).

- `Cleanup.ps1` which cleans-up the Azure Active Directory objects created by `Configure.ps1`. Note that this script does not revert the changes done in the configuration files, though. You will need to undo the change from source control (from Visual Studio, or from the command line using, for instance, git reset).
- `Cleanup.ps1` which cleans-up the Microsoft Entra objects created by `Configure.ps1`. Note that this script does not revert the changes done in the configuration files, though. You will need to undo the change from source control (from Visual Studio, or from the command line using, for instance, git reset).

### Usage pattern for tests and DevOps scenarios

The `Configure.ps1` will stop if it tries to create an Azure Active Directory application which already exists in the tenant. For this, if you are using the script to try/test the sample, or in DevOps scenarios, you might want to run `Cleanup.ps1` just before `Configure.ps1`. This is what is shown in the steps below.
The `Configure.ps1` will stop if it tries to create an Microsoft Entra application which already exists in the tenant. For this, if you are using the script to try/test the sample, or in DevOps scenarios, you might want to run `Cleanup.ps1` just before `Configure.ps1`. This is what is shown in the steps below.

## How to use the app creation scripts

Expand All @@ -64,10 +64,10 @@ The `Configure.ps1` will stop if it tries to create an Azure Active Directory ap
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
```

### Install AzureAD PowerShell modules
The scripts install the required PowerShell module (Azure Active Directory) for the current user if needed. However, if you want to install it for all users on the machine, you can follow the following steps:
### Install Microsoft Entra PowerShell modules
The scripts install the required PowerShell module (Microsoft Entra) for the current user if needed. However, if you want to install it for all users on the machine, you can follow the following steps:

4. If you have never done it already, in the PowerShell window, install the AzureAD PowerShell modules following these steps::
4. If you have never done it already, in the PowerShell window, install the Microsoft Entra PowerShell modules following these steps::

1. Open PowerShell as admin (On Windows, search **Powershell** in the Search bar, right click on it and select **Run as administrator**).
2. Type:
Expand Down Expand Up @@ -139,7 +139,7 @@ Of course, in real life, you might already get the password as a `SecureString`.

If you want to create the apps in a particular tenant, you can use the following option:
- open the [Azure portal](https://portal.azure.com)
- Select the Azure Active Directory you are interested in (in the combo-box below your name on the top right of the browser window)
- Select the Microsoft Entra ID you are interested in (in the combo-box below your name on the top right of the browser window)
- Find the "Active Directory" object in this tenant
- Go to **Properties** and copy the content of the **Directory Id** property
- Then use the full syntax to run the scripts:
Expand Down
6 changes: 3 additions & 3 deletions AppCreationScripts/sample.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Sample": {
"Title": "A client application that calls an ASP.NET Core Web API protected by Azure AD using OAuth 2.0 access tokens. ",
"Title": "A client application that calls an ASP.NET Core Web API protected by Microsoft Entra using OAuth 2.0 access tokens. ",
"Level": 200,
"Client": "SPA client application - UI to test Web Api",
"Service": "ASP.NET Core Web API",
Expand All @@ -9,7 +9,7 @@
},

/*
This section describes the Azure AD Applications to configure, and their dependencies
This section describes the Microsoft Entra Applications to configure, and their dependencies
*/
"AADApps": [
{
Expand Down Expand Up @@ -55,7 +55,7 @@

/*
This section describes how to update the code in configuration files from the apps coordinates, once the apps
are created in Azure AD.
are created in Microsoft Entra.
Each section describes a configuration file, for one of the apps, it's type (Javascript, JSon, plain text), its location
with respect to the root of the sample, and the mappping (which string in the config file is mapped to which value
*/
Expand Down
12 changes: 6 additions & 6 deletions MinimalClient/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# React single-page application built with MSAL React and Microsoft identity platform to demonstrate the Azure Communication Services Auth sample

This is a very simple client based on the autogenerated react single page app from the Azure Active Directory registered apps QuickStart. This should not be used for production and serves as a sample to see how the backend can be called.
This is a very simple client based on the autogenerated react single page app from the Microsoft Entra registered apps QuickStart. This should not be used for production and serves as a sample to see how the backend can be called.

## Prerequisites

- Backend server set up and running. (If deployed to a non-local environment, modify `SERVER_ADDRESS` in [acsAuthApiCaller.js](../MinimalClient/src/acsAuthApiCaller.js))
- Single page client app registered on Azure Active Directory.
- Single page client app registered on Microsoft Entra ID.
- Populate the [authConfig.js](../MinimalClient/src/authConfig.js) file with the `clientId`, `authority`, and `redirectUri` values from the client app registration.

## Running the client
Expand All @@ -16,14 +16,14 @@ This is a very simple client based on the autogenerated react single page app fr

## Joining a group call as a Communication Identity

1. Click **Sign in** and use the login dialog to log in with a valid Azure AD identity.
1. Click **Join Default Call** to join a call using the displayed randomly generated GUID, or use the **AAD Access Token** to directly call the backend API.
1. Click **Sign in** and use the login dialog to log in with a valid Microsoft Entra identity.
1. Click **Join Default Call** to join a call using the displayed randomly generated GUID, or use the **Microsoft Entra Access Token** to directly call the backend API.
1. To join a call with another device, share the GUID and enter it in the text box of the client wanting to join the same call.

## Joining a Teams meeting as a Teams user

1. Click **Sign in as a Teams user** then use the login dialog to log in with an Azure AD identity with a valid Teams license.
1. Click **Sign in as a Teams user** then use the login dialog to log in with an Microsoft Entra identity with a valid Teams license.
1. Fill in the **Teams Meeting Link** with the link to the meeting you want to join.
1. Click **Join as a Teams user** to join the specified meeting.
1. Alternatively, you can call the `GET /api/token/teams` endpoint with the AAD Access Token in the `Authorization: Bearer <token>` header and the AAD Token for a Teams user in the `teams-user-aad-token` header to generate a valid Communication Token.
1. Alternatively, you can call the `GET /api/token/teams` endpoint with the Microsoft Entra Access Token in the `Authorization: Bearer <token>` header and the Microsoft Entra Token for a Teams user in the `teams-user-aad-token` header to generate a valid Communication Token.
1. Or use the generated **Communication Token** to directly call the Calling API.
4 changes: 2 additions & 2 deletions MinimalClient/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { TestCallTeamsUserContent } from './components/TestCallTeamsUserContent'
import { useSessionStorage } from './reactExtensions';

/**
* If a user is authenticated as a regular Azure AD user, the TestCallContent component is rendered.
* If a user is authenticated as a Azure AD user with a valid teams license, the TestCallTeamsUserContent component is rendered.
* If a user is authenticated as a regular Microsoft Entra user, the TestCallContent component is rendered.
* If a user is authenticated as a Microsoft Entra user with a valid teams license, the TestCallTeamsUserContent component is rendered.
* Otherwise a message indicating a user is not authenticated is rendered.
*/
const MainContent = (props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const TestCallTeamsUserContent = () => {
})
.catch((error) => console.log(error));

// Silently acquires an access token which is then used as a payload for the (AAD->ACS) token exchange
// Silently acquires an access token which is then used as a payload for the (Microsoft Entra ID->ACS) token exchange
const teamsAadToken = await instance
.acquireTokenSilent({
...teamsUserRequest,
Expand Down
Loading