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
+45-33Lines changed: 45 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,39 @@
1
-
# Registering the sample apps with Microsoft identity platform and updating the configuration files using PowerShell scripts
1
+
# Registering sample apps with the Microsoft identity platform and updating the configuration files using PowerShell
2
2
3
3
## Overview
4
4
5
5
### Quick summary
6
6
7
-
1. On Windows run PowerShell and navigate to the root of the cloned directory
7
+
1. On Windows, run PowerShell as **Administrator** and navigate to the root of the cloned directory
8
8
1. In PowerShell run:
9
+
9
10
```PowerShell
10
11
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
11
12
```
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
+
14
+
1. Run the script to create your Azure AD application and configure the code of the sample application accordingly.
15
+
13
16
```PowerShell
14
17
cd .\AppCreationScripts\
15
18
.\Configure.ps1
16
19
```
17
-
1. Open the Visual Studio solution and click start
18
20
19
21
### More details
20
22
21
-
The following paragraphs:
22
-
23
-
-[Present the scripts](#presentation-of-the-scripts) and explain their [usage patterns](#usage-pattern-for-tests-and-devops-scenarios) for test and DevOps scenarios.
24
-
- Explain the [pre-requisites](#pre-requisites)
25
-
- Explain [four ways of running the scripts](#four-ways-to-run-the-script):
26
-
-[Interactively](#option-1-interactive) to create the app in your home tenant
27
-
-[Passing credentials](#option-2-non-interactive) to create the app in your home tenant
28
-
-[Interactively in a specific tenant](#option-3-interactive-but-create-apps-in-a-specified-tenant)
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)
31
-
32
-
## Goal of the scripts
23
+
-[Goal of the provided scripts](#goal-of-the-provided-scripts)
24
+
-[Presentation of the scripts](#presentation-of-the-scripts)
25
+
-[Usage pattern for tests and DevOps scenarios](#usage-pattern-for-tests-and-DevOps-scenarios)
26
+
-[How to use the app creation scripts?](#how-to-use-the-app-creation-scripts)
27
+
-[Pre-requisites](#pre-requisites)
28
+
-[Run the script and start running](#run-the-script-and-start-running)
29
+
-[Four ways to run the script](#four-ways-to-run-the-script)
-[Option 3 (Interactive, but create apps in a specified tenant)](#option-3-Interactive-but-create-apps-in-a-specified-tenant)
33
+
-[Option 4 (non-interactive, and create apps in a specified tenant)](#option-4-non-interactive-and-create-apps-in-a-specified-tenant)
34
+
-[Running the script on Azure Sovereign clouds](#running-the-script-on-Azure-Sovereign-clouds)
35
+
36
+
## Goal of the provided scripts
33
37
34
38
### Presentation of the scripts
35
39
@@ -39,13 +43,13 @@ These scripts are:
39
43
40
44
-`Configure.ps1` which:
41
45
- creates Azure AD applications and their related objects (permissions, dependencies, secrets),
42
-
- changes the configuration files in the C# and JavaScript projects.
46
+
- changes the configuration files in the sample projects.
43
47
- creates a summary file named `createdApps.html` in the folder from which you ran the script, and containing, for each Azure AD application it created:
44
48
- the identifier of the application
45
49
- the AppId of the application
46
50
- the url of its registration in the [Azure portal](https://portal.azure.com).
47
51
48
-
-`Cleanup.ps1` which cleans-up the Azure AD 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).
52
+
-`Cleanup.ps1` which cleans-up the Azure AD 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`).
49
53
50
54
### Usage pattern for tests and DevOps scenarios
51
55
@@ -56,53 +60,60 @@ The `Configure.ps1` will stop if it tries to create an Azure AD application whic
56
60
### Pre-requisites
57
61
58
62
1. Open PowerShell (On Windows, press `Windows-R` and type `PowerShell` in the search window)
59
-
2. Navigate to the root directory of the project.
60
-
3. Until you change it, the default [Execution Policy](https:/go.microsoft.com/fwlink/?LinkID=135170) for scripts is usually `Restricted`. In order to run the PowerShell script you need to set the Execution Policy to `RemoteSigned`. You can set this just for the current PowerShell process by running the command:
63
+
1. Navigate to the root directory of the project.
64
+
1. Until you change it, the default [Execution Policy](https:/go.microsoft.com/fwlink/?LinkID=135170) for scripts is usually `Restricted`. In order to run the PowerShell script you need to set the Execution Policy to `RemoteSigned`. You can set this just for the current PowerShell process by running the command:
65
+
61
66
```PowerShell
62
67
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
The scripts install the required PowerShell module (AzureAD) for the current user if needed. However, if you want to install if for all users on the machine, you can follow the following steps:
66
73
67
-
4. If you have never done it already, in the PowerShell window, install the AzureAD PowerShell modules. For this:
74
+
1. If you have never done it already, in the PowerShell window, install the AzureAD PowerShell modules. For this:
68
75
69
-
1. Open PowerShell as admin (On Windows, Search Powershell in the search bar, right click on it and select Run as administrator).
76
+
1. Open PowerShell as admin (On Windows, Search Powershell in the search bar, right click on it and select **Run as administrator**).
70
77
2. Type:
78
+
71
79
```PowerShell
72
80
Install-Module AzureAD
73
81
```
74
82
75
83
or if you cannot be administrator on your machine, run:
84
+
76
85
```PowerShell
77
86
Install-Module AzureAD -Scope CurrentUser
78
87
```
79
88
80
89
### Run the script and start running
81
90
82
-
5. Go to the `AppCreationScripts` sub-folder. From the folder where you cloned the repo,
91
+
1. Go to the `AppCreationScripts` sub-folder. From the folder where you cloned the repo,
92
+
83
93
```PowerShell
84
94
cd AppCreationScripts
85
95
```
86
-
6. Run the scripts. See below for the [four options](#four-ways-to-run-the-script) to do that.
87
-
7. Open the Visual Studio solution, and in the solution's context menu, choose **Set Startup Projects**.
88
-
8. select **Start** for the projects
89
96
90
-
You're done. this just works!
97
+
1. Run the scripts. See below for the [four options](#four-ways-to-run-the-script) to do that.
98
+
1. Open the Visual Studio solution, and in the solution's context menu, choose **Set Startup Projects**.
99
+
1. select **Start** for the projects
100
+
101
+
You're done!
91
102
92
103
### Four ways to run the script
93
104
94
105
We advise four ways of running the script:
95
106
96
107
- Interactive: you will be prompted for credentials, and the scripts decide in which tenant to create the objects,
97
108
- non-interactive: you will provide credentials, and the scripts decide in which tenant to create the objects,
98
-
- Interactive in specific tenant: you will provide the tenant in which you want to create the objects and then you will be prompted for credentials, and the scripts will create the objects,
99
-
- non-interactive in specific tenant: you will provide tenant in which you want to create the objects and credentials, and the scripts will create the objects.
109
+
- Interactive in specific tenant: you will provide the tenant in which you want to create the objects and then you will be prompted for credentials, and the scripts will create the objects,
110
+
- non-interactive in specific tenant: you will provide the tenant in which you want to create the objects and credentials, and the scripts will create the objects.
100
111
101
112
Here are the details on how to do this.
102
113
103
114
#### Option 1 (interactive)
104
115
105
-
- Just run ``. .\Configure.ps1``, and you will be prompted to sign-in (email address, password, and if needed MFA).
116
+
- Just run ``.\Configure.ps1``, and you will be prompted to sign-in (email address, password, and if needed MFA).
106
117
- The script will be run as the signed-in user and will use the tenant in which the user is defined.
107
118
108
119
Note that the script will choose the tenant in which to create the applications, based on the user. Also to run the `Cleanup.ps1` script, you will need to re-sign-in.
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`.
164
+
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`.
Write-Host"Unable to remove ServicePrincipal 'TodoListService-ManualJwt' . Try deleting manually from Enterprise applications."-ForegroundColor White -BackgroundColor Red
90
+
}
75
91
Write-Host"Removing 'client' (TodoListClient-ManualJwt) if needed"
Write-Host"Unable to remove ServicePrincipal 'TodoListClient-ManualJwt' . Try deleting manually from Enterprise applications."-ForegroundColor White -BackgroundColor Red
0 commit comments