Skip to content

Instantly share code, notes, and snippets.

@mcharo
Last active October 31, 2016 02:30
Show Gist options
  • Select an option

  • Save mcharo/606b3c7c4f9ae448443fc979aec2f0a0 to your computer and use it in GitHub Desktop.

Select an option

Save mcharo/606b3c7c4f9ae448443fc979aec2f0a0 to your computer and use it in GitHub Desktop.
Get salt minion keys via saltapi
# Disable SSL validation
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
# Get saltapi credentials
$SaltApiCredential = Get-Credential
$user = $SaltApiCredential.UserName
$pass = $SaltApiCredential.GetNetworkCredential().Password
# Log in to saltapi
Invoke-RestMethod -Uri https://salt:7443/login -Method Post -Body @{username=$user;password=$pass;eauth='pam'} -SessionVariable session
# Get list of keys
$Body = @{client='wheel';tgt='*';fun='key.list_all'}
Invoke-RestMethod -Uri https://salt:7443 -Method Post -Body $Body -WebSession $session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment