create_named_credential

Creates a named credential. You can provide input parameters using command line arguments or an input properties file. It also supports the input_file tag for passwords and parameter values.

Standard Mode

 emcli create_named_credential
        -cred_name=<name>
        -auth_target_type=<authenticating_target_type>
        -cred_type=<credential_type>
        -cred_scope=<credential_scope>
        -cred_desc=<credential_description>
        -target_name=<target_name>
        -target_type=<target_type>
        -test
        -test_target_name=<test_target_name>
        -test_target_type=<test_target_type>
        -input_file=<tag:value>
        -input_bfile=<tag:value>
        -properties_file=<filename>
        -attributes=<p1:v1;p2:v2;...>

Interactive or Script Mode

 create_named_credential
        (cred_name=<name>
        ,auth_target_type=<authenticating_target_type>
        ,cred_type=<credential_type>
        ,cred_scope=<credential_scope>
        ,cred_desc=<credential_description>
        ,target_name=<target_name>
        ,target_type=<target_type>
        ,test
        ,test_target_name=<test_target_name>
        ,test_target_type=<test_target_type>
        ,input_file=<tag:value>
        ,input_bfile=<tag:value>
        ,properties_file=<filename>
        ,attributes=<p1:v1;p2:v2;...>)

Options

  • cred_name

    Credential name, such as MyBackUpCreds. This is required if you do not use properties_file.

  • auth_target_type

    Authenticating target type (e.g. host). This is required if you do not use properties_file.

  • cred_type

    Credential type. This is required if you do not use properties_file.

  • cred_scope

    Possible values are global|instance. The default is global.

  • cred_desc

    Credential description.

  • target_name

    This is required when cred_scope is instance.

  • target_type

    This is required when cred_scope is instance.

  • test

    Use this to test the credential before saving.

  • test_target_name

    Use this to supply the target name to test a global credential. This is required when cred_scope is global and the test parameter is used.

  • test_target_type

    Use this to supply the target type to test a global credential. This is required when cred_scope is global and the test parameter is used.

  • input_file

    Use this to supply sensitive property values from the file.

    For more information about the input_file parameter, see -input_file Syntax Guidelines.

  • input_bfile

    Use this to supply binary property values from the file.

    For more information about the input_file parameter, see -input_file Syntax Guidelines.

  • properties_file

    Use this to pass all parameters from the file. Values given on the command line take precedence.

  • attributes

    Specify credential columns as follows:

    colname:colvalue;colname:colvalue
    

    You can change the separator value using -separator=attributes=<newvalue>, and you can change the subseperator value using -subseparator=attributes=<newvalue>.

    For more information about the separator and subseperator parameters, see -input_file Syntax Guidelines.

Error Codes

0 - Success

1 and 223 - Syntax error

Examples

Example 1

This example create a HostCreds named credential with username foo and password bar:

emcli create_named_credential
        -cred_name=NC1
        -auth_target_type=host
        -cred_type=HostCreds
        -attributes="HostUserName:foo;HostPassword:bar"

Example 2

This example creates a privilege delegation credential with the user name foo, password bar, privilege delegation type SUDO, and RUNAS user root:

emcli create_named_credential 
        -cred_name=NC1 
        -auth_target_type=host 
        -cred_type=HostCreds
        -attributes="HostUserName:foo;HostPassword:bar;PDPTYPE:SUDO;RUNAS:root"

To use Powerbroker attributes, the string should be:

-attributes="HostUserName:foo;HostPassword:bar;PDPTYPE:POWERBROKER;RUNAS:root;
PROFILE:EMGC