Skip to content

Commit

Permalink
Fixes to certificate store location for MS Graph
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Dec 10, 2021
1 parent 995204a commit 3235370
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Modules/MSCloudLoginAssistant/MSCloudLoginAssistant.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Team Microsoft365DSC
#
# Generated on: 2021/12/09
# Generated on: 2021/12/10
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'MSCloudLoginAssistant.psm1'

# Version number of this module.
ModuleVersion = '1.0.81'
ModuleVersion = '1.0.82'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
18 changes: 15 additions & 3 deletions Modules/MSCloudLoginAssistant/Workloads/MicrosoftGraph.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,21 @@ function Connect-MSCloudLoginMicrosoftGraph
{
if ($Global:MSCloudLoginConnectionProfile.MicrosoftGraph.AuthenticationType -eq 'ServicePrincipalWithThumbprint')
{
Connect-MgGraph -ClientId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ApplicationId `
-TenantId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.TenantId `
-CertificateThumbprint $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.CertificateThumbprint | Out-Null
try
{
Connect-MgGraph -ClientId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ApplicationId `
-TenantId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.TenantId `
-CertificateThumbprint $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.CertificateThumbprint `
-ErrorAction Stop | Out-Null
}
catch
{
# Check into the localmachine store
$cert = Get-ChildItem "Cert:\LocalMachine\My\$($Global:MSCloudLoginConnectionProfile.MicrosoftGraph.CertificateThumbprint)"
Connect-MgGraph -ClientId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ApplicationId `
-TenantId $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.TenantId `
-Certificate $cert | Out-Null
}
$Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ConnectedDateTime = [System.DateTime]::Now.ToString()
$Global:MSCloudLoginConnectionProfile.MicrosoftGraph.MultiFactorAuthentication = $false
$Global:MSCloudLoginConnectionProfile.MicrosoftGraph.Connected = $true
Expand Down

0 comments on commit 3235370

Please sign in to comment.