Using Certificate-Based Authentication with Microsoft Graph PowerShell SDK (Real Demo)

preview_player
Показать описание
microsoft graph,microsoft azure,powershell,microsoft,microsoft 365,management,open-source,depreciated,sdks,restful,replace,rest api,msonline,community,azure cloud,pnp,cloud

PowerShell script to create self signed certificate.

$FilePath = 'C:\Users\Dipes\Desktop\certificates\abc'
$StoreLocation = 'CurrentUser' # be aware that LocalMachine requires elevated privileges
$expirationYears = 1

$SubjectName = $tenant_id + '.' + $client_id
$cert_password = $client_id

$pfxFileName = $SubjectName + '.pfx'
$cerFileName = $SubjectName + '.cer'

$PfxFilePath = $FilePath + $pfxFileName
$CerFilePath = $FilePath + $cerFileName

$CertBeginDate = Get-Date
$CertExpiryDate = $CertBeginDate.AddYears($expirationYears)

$SecStringPw= ConvertTo-SecureString -String $cert_password -Force -AsPlainText

$Cert = New-elfSignedCertificate -DnsName $SubjectName -CertStoreLocation "cert:\$StoreLocation\My" -NotBefore $CertBeginDate -NotAfter $CertExpiryDate -KeySpec Signature

Export-PfxCetificate -cert $Cert -FilePath $PFXFilePath -Password $SecStringPw
Export-Certificate -cert $Cert -FilePath $CerFilePath

Connect Microsoft Graph
Connect-MgGraph -ClientID YOUR_APP_ID -TenantId YOUR_TENANT_ID -CertificateThumbprint ""

Certificate-Based Authentication
Microsoft Graph
PowerShell
SDK
Cloud Computing
Microsoft Azure
Developer Tools
Cloud Services
Programming
PowerShell SDK
Рекомендации по теме
Комментарии
Автор

Should there be a Key Vault used, such as for storing the Password of the Private Key or the certificate thumbprint ?

wqdfefffrehrtvplcsk
Автор

Good video. Exactly what I was looking for. Can you please post a video using Postman to connect to MS Graph?

Tacobell
Автор

Thanks for the video, very interesting. Could you please make on to connect to Microsoft Graph PowerShell SDK using a system managed Based Authentication ?

Golden-tyvp