Demystifying iControl REST Part 6: Token-Based Authentication
iControl REST. It’s iControl SOAP’s baby, brother, introduced back in TMOS version 11.4 as an early access feature but released fully in version 11.5.
Several articles on basic usage have been writ...
Updated Jan 06, 2024
Version 2.0JRahm
Admin
Joined January 20, 2005
JRahm
Admin
Joined January 20, 2005
Casey_Robertson
Mar 22, 2016Nimbostratus
Here's our function for getting the token:
function Get-F5Token
{
[CmdletBinding()]
param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
$F5LoadBalancer,
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
$user,
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
$password,
[int]$timeout = 28800
)
$json = @"
{
"user": {
"link": "https://localhost/mgmt/shared/authz/users/$user"
},
"timeout": $timeout,
"address": "$F5LoadBalancer"
}
"@
$method = "POST"
$uri = "https://$F5LoadBalancer/mgmt/shared/authz/tokens"
$return = Invoke-F5RestMethod -URL $uri -method $method -json $json -user $user -password $password
return $return
}Get-F5Token