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
{{ message }}
This repository was archived by the owner on May 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: 1-Authentication/1-sign-in/AppCreationScripts/AppCreationScripts.md
+3-15
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,6 @@
4
4
5
5
### Quick summary
6
6
7
-
1. On Windows, run PowerShell as **Administrator** and navigate to the root of the cloned directory
8
-
1. In PowerShell run:
9
-
10
-
```PowerShell
11
-
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
12
-
```
13
-
14
7
1. Run the script to create your Azure AD application and configure the code of the sample application accordingly.
15
8
16
9
```PowerShell
@@ -59,28 +52,23 @@ The `Configure.ps1` will stop if it tries to create an Azure AD application whic
59
52
60
53
### Pre-requisites
61
54
55
+
1. PowerShell 7 or later (see: [installing PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell))
62
56
1. Open PowerShell (On Windows, press `Windows-R` and type `PowerShell` in the search window)
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
-
66
-
```PowerShell
67
-
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
The scripts install the required PowerShell module (Microsoft.Graph.Applications) 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:
73
61
74
62
1. If you have never done it already, in the PowerShell window, install the Microsoft.Graph.Applications PowerShell modules. For this:
75
63
76
-
1. Open PowerShell as admin (On Windows, Search Powershell in the search bar, right click on it and select **Run as administrator**).
64
+
1. Open PowerShell
77
65
2. Type:
78
66
79
67
```PowerShell
80
68
Install-Module Microsoft.Graph.Applications
81
69
```
82
70
83
-
or if you cannot be administrator on your machine, run:
71
+
or if you want the modules to be installed for the current user only, run:
Copy file name to clipboardExpand all lines: 1-Authentication/1-sign-in/AppCreationScripts/Cleanup.ps1
+2-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
1
+
#Requires -Version7
2
+
2
3
[CmdletBinding()]
3
4
param(
4
5
[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')]
Copy file name to clipboardExpand all lines: 2-Authorization-I/1-call-graph/AppCreationScripts/AppCreationScripts.md
+7-18
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,6 @@
4
4
5
5
### Quick summary
6
6
7
-
1. On Windows, run PowerShell as **Administrator** and navigate to the root of the cloned directory
8
-
1. In PowerShell run:
9
-
10
-
```PowerShell
11
-
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
12
-
```
13
-
14
7
1. Run the script to create your Azure AD application and configure the code of the sample application accordingly.
15
8
16
9
```PowerShell
@@ -49,6 +42,8 @@ These scripts are:
49
42
50
43
-`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`).
51
44
45
+
> :information_source: If the sample supports using certificates instead of client secrets, this folder will contain an additional set of scripts: `Configure-WithCertificates.ps1` and `Cleanup-WithCertificates.ps1`. You can use them in the same way to register app(s) that use certificates instead of client secrets.
46
+
52
47
### Usage pattern for tests and DevOps scenarios
53
48
54
49
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.
@@ -57,28 +52,23 @@ The `Configure.ps1` will stop if it tries to create an Azure AD application whic
57
52
58
53
### Pre-requisites
59
54
55
+
1. PowerShell 7 or later (see: [installing PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell))
60
56
1. Open PowerShell (On Windows, press `Windows-R` and type `PowerShell` in the search window)
61
-
1. Navigate to the root directory of the project.
62
-
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:
63
-
64
-
```PowerShell
65
-
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
The scripts install the required PowerShell module (Microsoft.Graph.Applications) 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:
71
61
72
62
1. If you have never done it already, in the PowerShell window, install the Microsoft.Graph.Applications PowerShell modules. For this:
73
63
74
-
1. Open PowerShell as admin (On Windows, Search Powershell in the search bar, right click on it and select **Run as administrator**).
64
+
1. Open PowerShell
75
65
2. Type:
76
66
77
67
```PowerShell
78
68
Install-Module Microsoft.Graph.Applications
79
69
```
80
70
81
-
or if you cannot be administrator on your machine, run:
71
+
or if you want the modules to be installed for the current user only, run:
Write-Host ("Connected to Tenant {0} ({1}) as account '{2}'. Domain is '{3}'"-f$Tenant.DisplayName,$Tenant.Id,$currentUserPrincipalName,$verifiedDomainName)
56
+
35
57
# Removes the applications
36
58
Write-Host"Cleaning-up applications from tenant '$tenantId'"
37
59
38
60
Write-Host"Removing 'spa' (ms-identity-react-c2s1) if needed"
Write-Host"Unable to remove the application 'ms-identity-react-c2s1' . Try deleting manually."-ForegroundColor White -BackgroundColor Red
67
+
$message=$_
68
+
Write-Warning$Error[0]
69
+
Write-Host"Unable to remove the application 'ms-identity-react-c2s1'. Error is $message. Try deleting manually."-ForegroundColor White -BackgroundColor Red
46
70
}
47
71
48
72
Write-Host"Making sure there are no more (ms-identity-react-c2s1) applications found, will remove if needed..."
Write-Host"Unable to remove ServicePrincipal 'ms-identity-react-c2s1' . Try deleting manually from Enterprise applications."-ForegroundColor White -BackgroundColor Red
93
+
$message=$_
94
+
Write-Warning$Error[0]
95
+
Write-Host"Unable to remove ServicePrincipal 'ms-identity-react-c2s1'. Error is $message. Try deleting manually from Enterprise applications."-ForegroundColor White -BackgroundColor Red
70
96
}
71
97
}
72
98
73
-
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph.Applications")) {
0 commit comments