Skip to main content

SYNOPSIS

Shared implementation for the Switch-*Mode auth-mode togglers.

SYNTAX

Switch-PS365WamAuthMode [-Label] <String> [-GetState] <ScriptBlock> [-SetState] <ScriptBlock>
 [[-Mode] <String>] [-GetCurrent] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Switch-AzureCliAuthMode / Switch-AzurePowerShellMode / Switch-MgGraphPowerShellMode functions were ~identical (only the get/set cmdlets and the product label differed). This helper centralizes the toggle/ set/get-current logic; each public function passes its own GetState/SetState script blocks and label.

EXAMPLES

PARAMETERS

-Label

Product label used in the confirmation message (e.g. ‘Azure CLI’).
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-GetState

Script block returning the current WAM-enabled state as a boolean.
Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SetState

Script block that takes a single boolean (the desired WAM-enabled state).
Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Mode

‘Browser’ or ‘WAM’. When omitted, the current state is toggled.
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-GetCurrent

Display the current mode without changing it.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES