You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AppCreationScripts/AppCreationScripts.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Registering the Azure Active Directory applications and updating the configuration files for this sample using PowerShell scripts
1
+
# Registering the sample apps with Microsoft identity platform and updating the configuration files using PowerShell scripts
2
2
3
3
## Overview
4
4
@@ -9,9 +9,10 @@
9
9
```PowerShell
10
10
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
11
11
```
12
-
1. Run the script to create your Azure AD application and configure the code of the sample application accordinly. (Other ways of running the scripts are described below)
12
+
1. Run the script to create your Azure AD application and configure the code of the sample application accordingly. (Other ways of running the scripts are described below)
13
13
```PowerShell
14
-
.\AppCreationScripts\Configure.ps1
14
+
cd .\AppCreationScripts\
15
+
.\Configure.ps1
15
16
```
16
17
1. Open the Visual Studio solution and click start
17
18
@@ -26,6 +27,7 @@ The following paragraphs:
26
27
-[Passing credentials](#option-2-non-interactive) to create the app in your home tenant
27
28
-[Interactively in a specific tenant](#option-3-interactive-but-create-apps-in-a-specified-tenant)
28
29
-[Passing credentials in a specific tenant](#option-4-non-interactive-and-create-apps-in-a-specified-tenant)
30
+
-[Passing environment name, for Sovereign clouds](#running-the-script-on-azure-sovereign-clouds)
29
31
30
32
## Goal of the scripts
31
33
@@ -49,7 +51,7 @@ These scripts are:
49
51
50
52
The `Configure.ps1` will stop if it tries to create an Azure AD 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.
51
53
52
-
## How to use the app creation scripts?
54
+
## How to use the app creation scripts?
53
55
54
56
### Pre-requisites
55
57
@@ -107,7 +109,7 @@ Note that the script will choose the tenant in which to create the applications,
107
109
108
110
#### Option 2 (non-interactive)
109
111
110
-
When you know the indentity and credentials of the user in the name of whom you want to create the applications, you can use the non-interactive approach. It's more adapted to DevOps. Here is an example of script you'd want to run in a PowerShell Window
112
+
When you know the identity and credentials of the user in the name of whom you want to create the applications, you can use the non-interactive approach. It's more adapted to DevOps. Here is an example of script you'd want to run in a PowerShell Window
All the four options listed above, can be used on any Azure Sovereign clouds. By default, the script targets `AzureCloud`, but it can be changed using the parameter `-AzureEnvironmentName`.
Copy file name to clipboardExpand all lines: AppCreationScripts/Cleanup.ps1
+16-9Lines changed: 16 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,28 @@
2
2
param(
3
3
[PSCredential] $Credential,
4
4
[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')]
5
-
[string] $tenantId
5
+
[string] $tenantId,
6
+
[Parameter(Mandatory=$False,HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
7
+
[string] $azureEnvironmentName
6
8
)
7
9
8
10
if ($null-eq (Get-Module-ListAvailable -Name "AzureAD")) {
9
11
Install-Module"AzureAD"-Scope CurrentUser
10
12
}
11
13
Import-Module AzureAD
12
-
$ErrorActionPreference='Stop'
14
+
$ErrorActionPreference="Stop"
13
15
14
16
FunctionCleanup
15
17
{
16
-
<#
17
-
.Description
18
-
This function removes the Azure AD applications for the sample. These applications were created by the Configure.ps1 script
19
-
#>
18
+
if (!$azureEnvironmentName)
19
+
{
20
+
$azureEnvironmentName="AzureCloud"
21
+
}
22
+
23
+
<#
24
+
.Description
25
+
This function removes the Azure AD applications for the sample. These applications were created by the Configure.ps1 script
26
+
#>
20
27
21
28
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
22
29
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
@@ -25,17 +32,17 @@ This function removes the Azure AD applications for the sample. These applicatio
25
32
# you'll need to sign-in with creds enabling your to create apps in the tenant)
[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')]
5
-
[string] $tenantId
5
+
[string] $tenantId,
6
+
[Parameter(Mandatory=$False,HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
7
+
[string] $azureEnvironmentName
6
8
)
7
9
8
10
<#
@@ -39,7 +41,7 @@ Function AddResourcePermission($requiredAccess, `
0 commit comments