{"id":77,"date":"2016-10-12T12:28:08","date_gmt":"2016-10-12T12:28:08","guid":{"rendered":"http:\/\/172.23.1.43\/?p=77"},"modified":"2022-06-07T22:26:30","modified_gmt":"2022-06-07T22:26:30","slug":"powershell-http-authentication","status":"publish","type":"post","link":"https:\/\/blog.n-dol.org\/2016\/10\/12\/powershell-http-authentication\/","title":{"rendered":"PowerShell \u2013 HTTP Authentication"},"content":{"rendered":"\n
#Authentication Parameters\n#Credential used after initial communication\n$Credentials=Get-Credential\n#Building Authorisation Header for initial communication not used afterwards\n$Base64Auth=[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credentials.GetNetworkCredential().username + ":" + $Credentials.GetNetworkCredential().password ))\n$BasicCredentials = "Basic " + $Base64Auth\n$headers = @{"tenant-code" = $tenantAPIKey; "Authorization"= $BasicCredentials}\n$Output = Invoke-RestMethod -Method Post -Credential $Credentials -Uri $URI -Body $Body -ContentType $ContentType -Headers $headers <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":5614970,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[178495,672890843],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/posts\/77"}],"collection":[{"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/users\/5614970"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":5,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":1418,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/posts\/77\/revisions\/1418"}],"wp:attachment":[{"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.n-dol.org\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}