<a id="command-juju-set-credential"></a>

# `juju set-credential`

> See also: [credentials](https://documentation.ubuntu.com/juju/3.6/reference/juju-cli/list-of-juju-cli-commands/credentials.md), [show-credential](https://documentation.ubuntu.com/juju/3.6/reference/juju-cli/list-of-juju-cli-commands/show-credential.md), [update-credential](https://documentation.ubuntu.com/juju/3.6/reference/juju-cli/list-of-juju-cli-commands/update-credential.md)

## Summary

Relates a remote credential to a model.

## Usage

`juju set-credential [options] <cloud name> <credential name>`

### Options

| Flag                       | Default   | Usage                                                                      |
|----------------------------|-----------|----------------------------------------------------------------------------|
| `-B`, `--no-browser-login` | false     | Do not use web browser for authentication                                  |
| `-m`, `--model`            |           | Model to operate in. Accepts [<controller name>:]<model name>|<model UUID> |

## Examples

For cloud `aws`, relate remote credential `bob` to model `trinity`:

```none
juju set-credential -m trinity aws bob
```

## Details

This command relates a credential cached on a controller to a specific model.
It does not change/update the contents of an existing active credential. See
command `update-credential` for that.

The credential specified may exist locally (on the client), remotely (on the
controller), or both. The command will error out if the credential is stored
neither remotely nor locally.

When remote, the credential will be related to the specified model.

When local and not remote, the credential will first be uploaded to the
controller and then related.

This command does not affect an existing relation between the specified
credential and another model. If the credential is already related to a model
this operation will result in that credential being related to two models.

Use the `show-credential` command to see how remote credentials are related
to models.
