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

Показать описание
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
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
Комментарии