How to delete credential store and alias using JBoss CLI

Posted on

I am trying to create credential store and an alias using JBoss CLI script and then delete them using script. I am doing it as follows:

I have the following script: jboss-credential-store-add.cli


/subsystem=elytron/credential-store=credential_store_vsit:add(location="credentials_vsit/csstore.jceks",,  credential-reference={clear-text=credential_mypassword},create=true)

/subsystem=elytron/credential-store=credential_store_vsit:add-alias(alias=credential-store-alias_vsit, secret-value="certificate-password")


I run the following command to execute the above script, I get the following output.
./ --connect --file=jboss-credential-store-add.cli

The batch executed successfully

I have another script: jboss-credential-store-remove.cli



when I try to run it as follows:
./ --connect --file=jboss-credential-store-remove.cli,
I get the following error.

    "outcome" => "failed",
    "result" => undefined,
    "failure-description" => "WFLYELY00920: Credential alias 'credential-store-alias-vsit' of credential type '' does not exist in the store",
    "rolled-back" => true

I have tried a lot of things for jboss-credential-store-remove.cli like changing order of the commands in above script / running as batch etc. but it is not working.

Basically I want to perform clean up using jboss-credential-store-remove.cli what was created using jboss-credential-store-add.cli

How can I achieve it.