Forum Discussion

dfosborne2_2224's avatar
dfosborne2_2224
Icon for Nimbostratus rankNimbostratus
Jun 23, 2014

Create users for BigIP via REST

Can user accounts be created via REST in BigIP LTM? If so, could someone provide the syntax? Ive dug around and around the API and cannot find it. Assumed either mgmt/tm/ltm/auth or mgmt/tm/sys/ would be the place to find it but I cannot. Thank you!

 

2 Replies

  • Try this:

    curl -sk -u 'admin:admin' -H "Content-Type: application/json" -X POST https://x.x.x.x/mgmt/tm/auth/user -d '{"name":"bob","password":"mypass","role":"admin","partition-access":"all","shell":"bash"}'
    
  • To get this to work in v12, I had to take an extra step.

    $jsonuser = @"
        {
            "name": "xadmin",
            "password": "pass@word1",
            "role": "admin",
            "shell": "tmsh",
            "partitionaccess": [ {
                "name": "all-partitions",
                "role": "admin"
                }
            ]
        }
        "@
    
    $rolejson = @"
    {
    "partitionAccess": [
    {
    "name": "all-partitions",
    "role": "admin"
    }
    ]
    }
    "@
    

    I could set partition with a POST, but not ROLE. So I had to use the following:

    curl -sk -u "admin:admin" 'https://10.0.0.5/mgmt/tm/auth/user' -X POST -d $o -H "Content-Type: application/json"
    `

    curl -sk -u "admin:admin" 'https://10.0.0.5/mgmt/tm/auth/user/xadmin' -X PATCH -d $rolejson -H "Content-Type: application/json"