Skip to content

Commit

Permalink
Username password account variable (#2059)
Browse files Browse the repository at this point in the history
* add username password page

* images

* change nav order

* Update dictionary-octopus.txt

* Spelling related fixes

---------

Co-authored-by: Steve Fenton <[email protected]>
  • Loading branch information
susanpann and steve-fenton-octopus authored Oct 31, 2023
1 parent 552b394 commit e5d675f
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 3 deletions.
1 change: 1 addition & 0 deletions dictionary-octopus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ octopusdeploy
octopusid
octopuslabs
octopusservernodes
octopusvariable
Octostache
OIDC
onlylogs
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/pages/docs/projects/variables/library-variable-sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pubDate: 2023-01-01
modDate: 2023-01-01
title: Library variable sets
description: Library variable sets allow you to define and share common variables between your Octopus projects.
navOrder: 90
navOrder: 100
---

Octopus [variables](/docs/projects/variables/) can be added to library variables sets, which make it possible to define variables for use with multiple [projects](/docs/projects).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
layout: src/layouts/Default.astro
pubDate: 2023-10-27
modDate: 2023-10-27
title: Username and password account variables
description: Create a Username and password account variable to use in any deployment step
navOrder: 90
---

[Username and password accounts](/docs/infrastructure/accounts/username-and-password/) can be referenced in a project through a project [variable](/docs/projects/variables) of the type **UsernamePassword account**. Before you create a Username and Password account Variable, you need to create a Username and Password account in Octopus:

:::figure
![Username Password account variable](/docs/projects/variables/images/username-password-account-variable.png)
:::

The **Add Variable** window is then displayed and lists all the Username and Password accounts.

Select the Username and Password account you want to access from the project to assign it to the variable:

:::figure
![Username Password account variable selection](/docs/projects/variables/images/username-password-account-variable-selection.png)
:::


## Username and password account variable properties

The Username and Password account variable also exposes the following properties that you can reference in a PowerShell script:

| Name and description | Example |
|------------------------------------------------------------------------|-------------|
| **`Username`** <br/> The username of the Username and password account | BobSmith_85 |

### Accessing the properties in a script

Each of the above properties can be referenced in any of the supported scripting languages such as PowerShell and Bash.

<details data-group="project-variables-username-password-account-variables">
<summary>PowerShell</summary>

```powershell
# For an account with a variable name of 'username password account'
# Using $OctopusParameters
Write-Host 'UsernamePasswordAccount.Id=' $OctopusParameters["username password account"]
Write-Host 'UsernamePassword.Username=' $OctopusParameters["username password account.Username"]
# Directly as a variable
Write-Host 'UsernamePassword.Id=' #{username password account}
Write-Host 'UsernamePassword.Username=' #{username password account.Username}
```

</details>
<details data-group="project-variables-username-password-account-variables">
<summary>Bash</summary>

```bash
# For an account with a variable name of 'username password account'

id=$(get_octopusvariable "username password account")
client=$(get_octopusvariable "username password.Username")
echo "Username Password Account Id is: $id"
echo "Username Password Account Username is: $username"
```

</details>

## Add a Username and Password account to Octopus

For instructions to set up a Username and Password account in Octopus, see [Username and password accounts](/docs/infrastructure/accounts/username-and-password).

## Learn more

- [Variable blog posts](https://octopus.com/blog/tag/variables)
- How to create [Username and password accounts](/docs/infrastructure/accounts/username-and-password)
4 changes: 2 additions & 2 deletions src/pages/docs/projects/variables/variable-templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pubDate: 2023-01-01
modDate: 2023-01-01
title: Variable templates
description: Variable templates can be defined in Octopus to indicate which variable values are required to successfully deploy a project.
navOrder: 100
navOrder: 110
---
import TenantsWhichVariableTemplatesApply from 'src/shared-content/tenants/tenants-which-variable-templates-apply.include.md';

Expand Down Expand Up @@ -40,7 +40,7 @@ To specify common variables that can be used across multiple tenants, you need t
| **Options** | (Only applies when Data type: Drop down). This defines the list of options available for the user to select from the drop down list. Enter each option on a new line. Use `|` to separate values and display text. | `Value1|Display text 1` <br>`Value2|Display text 2` |

:::figure
![](/docs/projects/variables/images/variable-templates-libraryset.png "width=500")
![](/docs/projects/variables/images/variable-templates-library-set.png "width=500")
:::

To set common variable values for a tenant:
Expand Down

0 comments on commit e5d675f

Please sign in to comment.