diff --git a/dictionary-octopus.txt b/dictionary-octopus.txt index 849747fdb1..dc641e2973 100644 --- a/dictionary-octopus.txt +++ b/dictionary-octopus.txt @@ -28,6 +28,7 @@ octopusdeploy octopusid octopuslabs octopusservernodes +octopusvariable Octostache OIDC onlylogs diff --git a/public/docs/projects/variables/images/username-password-account-variable-selection.png b/public/docs/projects/variables/images/username-password-account-variable-selection.png new file mode 100644 index 0000000000..415b76a14d Binary files /dev/null and b/public/docs/projects/variables/images/username-password-account-variable-selection.png differ diff --git a/public/docs/projects/variables/images/username-password-account-variable.png b/public/docs/projects/variables/images/username-password-account-variable.png new file mode 100644 index 0000000000..d3d134a453 Binary files /dev/null and b/public/docs/projects/variables/images/username-password-account-variable.png differ diff --git a/public/docs/projects/variables/images/variable-templates-libraryset.png b/public/docs/projects/variables/images/variable-templates-library-set.png similarity index 100% rename from public/docs/projects/variables/images/variable-templates-libraryset.png rename to public/docs/projects/variables/images/variable-templates-library-set.png diff --git a/src/pages/docs/projects/variables/library-variable-sets.md b/src/pages/docs/projects/variables/library-variable-sets.md index e1999fd0c8..f727c144c5 100644 --- a/src/pages/docs/projects/variables/library-variable-sets.md +++ b/src/pages/docs/projects/variables/library-variable-sets.md @@ -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). diff --git a/src/pages/docs/projects/variables/username-password-account-variables.md b/src/pages/docs/projects/variables/username-password-account-variables.md new file mode 100644 index 0000000000..fd58264fd7 --- /dev/null +++ b/src/pages/docs/projects/variables/username-password-account-variables.md @@ -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`**
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. + +
+PowerShell + +```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} +``` + +
+
+Bash + +```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" +``` + +
+ +## 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) diff --git a/src/pages/docs/projects/variables/variable-templates.mdx b/src/pages/docs/projects/variables/variable-templates.mdx index f1ec6bd6a3..67fe66fd84 100644 --- a/src/pages/docs/projects/variables/variable-templates.mdx +++ b/src/pages/docs/projects/variables/variable-templates.mdx @@ -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'; @@ -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`
`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: