Skip to content

Organization parameter is not used in PowerShell script #4

@codingsteff

Description

@codingsteff

Problem

The organization parameter is defined in the PowerShell script backup-repos.ps1 but is never used. The script relies on Azure CLI configuration instead.

Current State

  1. PowerShell Script: The organization parameter is defined but not used
  2. run.sh: Sets the organization via az devops configure --defaults organization=https://dev.azure.com/$AZURE_DEVOPS_EXT_ORG
  3. README.md: Documents the parameter, but it's misleading since it's not actually used

Possible Solutions

Option 1: Use the parameter

The PowerShell script should use the organization parameter to set the Azure CLI configuration:

if ($organization) {
    az devops configure --defaults organization=https://dev.azure.com/$organization
}

Option 2: Alternative approaches for setting organization

  1. Azure CLI Configuration (currently used):

    az devops configure --defaults organization=https://dev.azure.com/[ORG]
  2. Environment Variable AZURE_DEVOPS_EXT_ORG (used in Docker container):

    export AZURE_DEVOPS_EXT_ORG=contoso
  3. Parameter with each az devops command:

    az devops project list --organization https://dev.azure.com/[ORG]

Recommended Solution

  1. Use the organization parameter in the PowerShell script
  2. Update README.md to document all available options
  3. Implement fallback logic: Parameter → Environment Variable → Configuration

Affected Files

  • backup-repos.ps1: Use the parameter
  • README.md: Update documentation
  • run.sh: Possibly adjust for consistent parameter passing

Additional Context

The current implementation causes confusion because:

  • Users pass the -organization parameter but it has no effect
  • The actual organization is set via environment variable or CLI configuration
  • Documentation doesn't reflect the actual behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions