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
Explained how to create service principal (Azure#3530)
* Explained how to create service principal
Also made several other minor formatting edits
* Fixed formatting around Service Principal conn str
* Updated Nuget instructions
Instructions to manually download it are available on NuGet. However TestFramework will be downloaded automatically as part of the build process, so manually downloading it should generally be unnecessary.
30
29
31
30
## 3. Setup prior to Record/Playback of tests
32
31
In order to Record/Playback a test, you need to setup a connection string that consists various key/value pairs that provides information to the test environment.
33
32
34
33
#### 3.1 Environment Variables
34
+
35
35
> TEST_CSM_ORGID_AUTHENTICATION
36
36
37
-
> AZURE_TEST_MODE
37
+
This is the connection string that determined how to connect to Azure. This includes both your authentiation and the Azure environment to connect to.
1. The default mode is Playback mode, so no setting up of connection string is required.
128
+
129
+
The default mode is Playback mode, so no setting up of connection string is required.
128
130
129
131
#### Record Test with Interactive login using OrgId
132
+
133
+
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`.
134
+
135
+
To use this option, set the following environment variable before starting Visual Studio:
This is the preferred option because it works with both .NET Framework and .NET Core.
142
+
143
+
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).
144
+
145
+
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}`.
To use this option, set the following environment variable before starting Visual Studio. The following values are substituted into the below connection string:
150
+
151
+
`clientId`: 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)
152
+
153
+
`clientSecret`: A [Service Principal Authentication Key](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#get-application-id-and-authentication-key)
154
+
155
+
`tenantId`: The [AAD Tenant ID](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#get-tenant-id)
2. Run the test and make sure that you got a generated .json file that matches the test name in the bin folder under *SessionRecords folder
136
-
3. Copy SessionRecords folder inside the test project and add all *.json files in Visual Studio setting "Copy to Output Directory" property to "Copy if newer"
160
+
161
+
2. Run the test and make sure that you got a generated .json file that matches the test name in the bin folder under *SessionRecords folder
162
+
3. Copy SessionRecords folder inside the test project and add all *.json files in Visual Studio setting "Copy to Output Directory" property to "Copy if newer"
137
163
4. To assure that the records work fine, delete the connection string (default mode is Playback mode) OR change HttpRecorderMode within the connection string to "Playback"
138
164
139
165
## 5. Change Test Environment settings at run-time
0 commit comments