Skip to content

Commit 18a3daa

Browse files
committed
Add instructions on running the new LiveOnly tests
1 parent 88fd893 commit 18a3daa

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Authentication.Test/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# Authentication Test
1+
# Authentication Test
2+
3+
## Running Live Authentication Tests
4+
5+
In the [`LoginTests.cs`](.\LoginTests.cs) file, there are two tests that can be run to perform live authentication: `LoginWithUsernameAndPassword` and `LoginWithServicePrincipal`.
6+
7+
### Username and Password
8+
9+
The [`LoginWithUsernameAndPassword`](.\LoginTests.cs#L79) test simulates running the `Connect-AzAccount` cmdlet with a username and password. This test requires no additional setup; however, since the .NET Core authentication uses device code login, and because we aren't using a PowerShell widow to display messages during the test, you will need to set a breakpoint in the [`UserTokenProvider.Netcore.cs`](..\Authentication\Authentication\UserTokenProvider.Netcore.cs#L217) file where the `code` variable is used. The `Message` property of this variable contains the message that is normally displayed in .NET Core authentication, which will tell you to visit https://microsoft.com/devicelogin and enter the given code for authentication.
10+
11+
### Service Principal
12+
13+
The [`LoginWithServicePrincipal`](.\LoginTests.cs#L87) test simulates running the `Connect-AzAccount` cmdlet with a service principal. This test requires the following fields to be updated in the `LoginTests.cs` file:
14+
- [`_tenantId`](.\LoginTests.cs#L45) - Id of the tenant that the service principal is registered to
15+
- [`_userName`](.\LoginTests.cs#L48) - Application id of the service principal
16+
- [`_password`](.\LoginTests.cs#L49) - Secret of the service principal
17+
18+
Once these values are updated, no other action is needed outside of running the test.

0 commit comments

Comments
 (0)