This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-AWSTempCred { | |
[CmdletBinding()] | |
param ( | |
[string]$ADFSHost='adfs.domain.com', ##Change for environment-appropriate default if desired | |
[string]$RelyingParty = 'urn:amazon:webservices', | |
[pscredential]$Credential | |
) | |
$WebRequestParams=@{ #Initialize parameters object | |
Uri = "https://$ADFSHost/adfs/ls/IdpInitiatedSignon.aspx?LoginToRP=$RelyingParty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$WebRootURL='https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_actions-resources-contextkeys.html' | |
## Retrieve service information from AWS Documentation | |
$BaseURL = $WebRootURL -replace "[^/]*$" | |
$Links = Invoke-WebRequest -UseBasicParsing -Uri $WebRootURL | select -ExpandProperty links |?{$_.href -like "list_*" -and !($_.class)} | |
$i=0 | |
$Links |%{ | |
$i++ | |
Write-Progress -Activity "Retrieving details AWS services" -Status "Service $i of $($Links.Count)" -CurrentOperation $_.href -PercentComplete (($i/($links.count))*100) | |
$ServiceMatch = Invoke-WebRequest -UseBasicParsing -Uri "${BaseURL}$($_.href)" | Select -ExpandProperty Content | Select-String '\<p\>(.*?) \(service prefix\: \<code class=\"code\"\>(.*?)\<\/code\>\)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-ADFSPEM ($ADFSHost) { | |
$key = ([xml](Invoke-WebRequest -UseBasicParsing -Uri "https://$ADFSHost/federationmetadata/2007-06/federationmetadata.xml").content).EntityDescriptor.Signature.KeyInfo.X509Data.X509Certificate | |
Write-Host "Single Line:" -ForegroundColor Green | |
write-host $key | |
write-host "" | |
Write-Host "Multi-Line PEM format:" -ForegroundColor Green | |
Write-Host "-----BEGIN CERTIFICATE-----" | |
0..[math]::Floor($key.Length/64) |%{ | |
write-host ($key[($_*64)..(($_*64)+63)] -join '') | |
} |