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: documentation/testing-docs/using-azure-test-framework.md
+3-36Lines changed: 3 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,8 @@
6
6
- [New-TestCredential](#new-testcredential)
7
7
- [Create New Service Principal](#create-new-service-principal)
8
8
- [Use Existing Service Principal](#use-existing-service-principal)
9
-
- [UserId](#userid)
10
9
- [Set-TestEnvironment](#set-testenvironment)
11
10
- [Existing Service Principal](#existing-service-principal)
12
-
- [UserId](#userid)
13
11
- [Manually Set Environment Variables](#manually-set-environment-variables)
14
12
- [Environment Variables](#environment-variables)
15
13
- [Playback Test](#playback-test)
@@ -51,11 +49,11 @@ This cmdlet, located in the [`Repo-Tasks` module](/tools/Repo-Tasks.psd1), which
51
49
Using a service principal is the preferred option for recording tests because it works with both .NET Framework and .NET Core. In order to create a new service principal, run this command with an unused service principal display name:
This command will create a new service principal, set the correct role assignment for this service principal based upon the subscription provided, and place the service principal id and secret into the credentials file.
56
+
This command will create a new service principal, set the correct role assignment for this service principal based upon the subscription provided, and place the service principal id and automatically generated secret into the credentials file.
59
57
60
58
Alternatively, to create a service principal, follow the [Azure AD guide to create a Application Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#create-an-active-directory-application). The application type should be `Web app / API` and the sign-on URL value is irrelevant (you can set any value).
61
59
@@ -68,15 +66,6 @@ New-TestCredential -ServicePrincipalDisplayName "Existing Service Principal" -Se
This is no longer the preferred option because it only works when running on .NET Framework. When running on .NET Core you may get an error like `Interactive Login is supported only in NET45 projects`. Additionally, you will have to manually log in when running the scenario tests rather than being automatically validated.
This is no longer the preferred option because it only works when running on .NET Framework. When running on .NET Core you may get an error like `Interactive Login is supported only in NET45 projects`.
#### Record Test with Interactive login using OrgId
122
-
123
-
This is no longer the preferred option because it only works when running on .NET Framework. When running on .NET Core you may get an error like `Interactive Login is supported only in NET45 projects`.
124
-
125
-
To use this option, set the following environment variables before starting Visual Studio:
This is the preferred option for recording tests because it works with both .NET Framework and .NET Core.
135
-
136
103
After the service principal is created, you will need to give it access to Azure resources. This can be done with the following PowerShell command, with the [Service Principal Application ID](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#get-application-id-and-authentication-key) (this is a guid, not the display name of the service principal) substituted in for `{clientId}`.
if ($existingServicePrincipal-eq$null-and ($Force-or$PSCmdlet.ShouldContinue("ServicePrincipal `""+$ServicePrincipalDisplayName+"`" does not exist, would you like to create a new ServicePrincipal with this name?","Create ServicePrincipal?")))
86
75
{
76
+
if (![string]::IsNullOrEmpty($ServicePrincipalSecret))
77
+
{
78
+
Write-Warning"Service Principal secrets are randomly generated, so provided secret value will not be used during creation."
79
+
}
80
+
87
81
if ($TargetEnvironment-ne'Prod')
88
82
{
89
83
throw"To create a new Service Principal you must be in Prod. Please run again with `$TargetEnvironment set to 'Prod'"
0 commit comments