
MarkLogic Server 11.0 Product Documentation
sec:create-credentialsec:create-credential(
$name as xs:string,
$description as xs:string,
$username as xs:string?,
$password as xs:string?,
$certificate as xs:string?,
$private-key as xs:string?,
$signing as xs:boolean,
$targets as element(sec:credential-target)*,
$permissions as element(sec:permission)*
) as xs:unsignedLong
Summary
This function creates a new security
credential with the specified values.
| Parameters |
| name |
A name for this
credential.
|
| description |
A description
for this credential.
|
| username |
An optional username
for this credential.
|
| password |
An optional password
for this credential.
|
| certificate |
An optional PEM
encoded certificate for this credential.
|
| private-key |
An optional PEM
encoded private key for this credential.
|
| signing |
Whether this
credential may be used for signing certificates.
|
| targets |
Any targets that
this credential may be used to access.
|
| permissions |
Permissions for who
can access this credential. Read allows viewing of the
credential, including encrypted keys. Execute only allows
use of the credential. Read implies execute.
|
Required Privileges
http://marklogic.com/xdmp/privileges/create-credential
Usage Notes
This function must be executed against the security database.
Example
xquery version "1.0-ml";
import module namespace sec = "http://marklogic.com/xdmp/security"
at "/MarkLogic/security.xqy";
sec:create-credential("my-secure-credential", "a secure credential",
"secure-user", "secure-password", (), (), fn:false(), (),
xdmp:permission("secure-role", "execute"))
Copyright © 2026 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.