lowlydba.sqlserver.credential module – Configures a credential on a SQL server

Note

This module is part of the lowlydba.sqlserver collection (version 2.3.4).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install lowlydba.sqlserver. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: lowlydba.sqlserver.credential.

New in lowlydba.sqlserver 1.3.0

Synopsis

  • Creates, replaces, or removes a credential on a SQL server.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter

Comments

force

boolean

If this switch is enabled, the existing credential will be dropped and recreated.

Choices:

  • false ← (default)

  • true

identity

string / required

The Credential Identity.

mapped_class_type

string

Sets the class associated with the credential.

Choices:

  • "CryptographicProvider"

  • "None"

name

string

The Credential name.

password

string

Password used to authenticate the Credential Identity.

provider_name

string

Specifies the cryptographic provider name for the Enterprise Key Management Provider.

sql_instance

string / required

The SQL Server instance to modify.

sql_password

string

Password for SQL Authentication.

sql_username

string

Username for SQL Authentication.

state

string

Whether or not the object should be present or absent.

Choices:

  • "present" ← (default)

  • "absent"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

platform

Platforms: all

Target OS/families that can be operated against.

Examples

- name: Create a credential with a password
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: ad\\user
    name: MyCredential
    password : <Password>

- name: Replace an existing credential
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: MyIdentity
    force: true

- name: Create a credential using a SAS token for a backup URL
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: SHARED ACCESS SIGNATURE
    name: https://<azure storage account name>.blob.core.windows.net/<blob container>
    password : <Shared Access Token>

- name: Remove a credential
  lowlydba.sqlserver.credential:
    sql_instance: sql-01.myco.io
    identity: MyIdentity
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

data

dictionary

Output from the New-DbaDbCredential, Get-DbaDbCredential, or Remove-DbaDbCredential function.

Returned: success, but not in check_mode.

Authors

  • Joe Krilov (@Joey40)

  • John McCall (@lowlydba)