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
HelpMessage="Determines the scope of authentication context. This accepts `Process` for the current process, or `CurrentUser` for all sessions started by user.")]
this.ThrowParameterError($"{nameof(CertificateThumbprint)} or {nameof(CertificateName)} or {nameof(Certificate)}");
313
322
}
314
323
324
+
// A thumbprint will always have 40 characters since thumbprints are dynamically calculated as a SHA-1 hash of a certificate's binary data. A SHA-1 hash has a length of 40 hexadecimal numbers (160-bit = 20-byte).
325
+
// See https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.thumbprint?view=net-5.0#remarks.
It 'ShouldThrowExceptionWhenInvalidTenantIdIsSpecified' {
@@ -11,4 +12,14 @@ Describe 'Connect-MgGraph In Delegated Mode' {
11
12
It 'ShouldThrowExceptionWhenInvalidScopeIsSpecified' {
12
13
{ Connect-MgGraph-Scopes 'User.Read.XYZ'-ErrorAction Stop } | Should -Throw -ExpectedMessage "*The scope 'User.Read.XYZ offline_access profile openid' does not exist*"
13
14
}
15
+
}
16
+
17
+
Describe 'Connect-MgGraph In App Mode' {
18
+
It 'ShouldThrowExceptionWhenCertificateThumbprintLengthIs > 40' {
19
+
{ Connect-MgGraph-ClientId $RandomClientId-CertificateThumbprint '12345678901234567890123456789012345678901'-ErrorAction Stop } | Should -Throw -ExpectedMessage "*'CertificateThumbprint' must have a length of 40.*"
20
+
}
21
+
22
+
It 'ShouldThrowExceptionWhenCertificateThumbprintLengthIs < 40' {
23
+
{ Connect-MgGraph-ClientId $RandomClientId-CertificateThumbprint '123456789012345678901234567890123456789'-ErrorAction Stop } | Should -Throw -ExpectedMessage "*'CertificateThumbprint' must have a length of 40.*"
0 commit comments