Skip to content

Commit

Permalink
Update run.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
srozemuller committed May 30, 2024
1 parent 3ab08c2 commit cbedf41
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Security-BreakGlassCertRenewer/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ $graphHeader = @{
'Content-Type' = 'application/json'
Authorization = "Bearer {0}" -f $graphToken.token
}

$graphToken.token
#Obtain AccessToken for Microsoft Graph via the Managed Identity
$resourceURL = "https://graph.microsoft.com/"
$response = [System.Text.Encoding]::Default.GetString((Invoke-WebRequest -UseBasicParsing -Uri "$($env:IDENTITY_ENDPOINT)?resource=$resourceURL" -Method 'GET' -Headers @{'X-IDENTITY-HEADER' = "$env:IDENTITY_HEADER"; 'Metadata' = 'True'}).RawContentStream.ToArray()) | ConvertFrom-Json
$response.access_token
try {
import-module .\Modules\mem-monitor-functions.psm1
}
Expand All @@ -35,7 +37,7 @@ catch {
try {
Write-Information "Searching for certificates in key vault" -InformationAction Continue
$breakglassCertificateUrl = "{0}/certificates/{1}?api-version=7.4&maxresults=25&_=1714746115235" -f $env:KEYVAULT_URL, $env:BREAKGLASS_CERTNAME
$results = Invoke-RestMethod -Uri $breakglassCertificateUrl -Headers $keyvaultHeaders -Method Get
# $results = Invoke-RestMethod -Uri $breakglassCertificateUrl -Headers $keyvaultHeaders -Method Get
}
catch {
Throw "Unable to request certificates, $_"
Expand Down

0 comments on commit cbedf41

Please sign in to comment.