Skip to content

Use of PSDefaultParameters with the AzureRM module #6941

Closed
@wsmelton

Description

@wsmelton

Description

My PSDefaultParameters are not being honored with the AzureRm module because the module itself is setting the values. So in the end none of them get used and I have lost the ability to utilize the shortcut in PowerShell itself.

Script/Steps for Reproduction

Set this in your profile:

$PSDefaultParameterValues = @{
	"*:ResourceGroupName"='mygroup'
}

Import the module and then issue any command that utilizes that parameter. You are presented with this warning:

WARNING: Multiple different default values are defined in $PSDefaultParameterValues for the parameter matching the following name or alias: ResourceGroupName. These defaults have been ignored.

I also find it odd (borderline annoying) that you are also clearing the default parameters upon import of every module within AzureRm, all the child modules have the following line at the start of their psm1 files: $PSDefaultParameterValues.Clear().

Module Version

6.6.0

Environment Data

Name                           Value                                                                                  
----                           -----                                                                                  
PSVersion                      5.1.17134.165                                                                          
PSEdition                      Desktop                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                
BuildVersion                   10.0.17134.165                                                                         
CLRVersion                     4.0.30319.42000                                                                        
WSManStackVersion              3.0                                                                                    
PSRemotingProtocolVersion      2.3                                                                                    
SerializationVersion           1.1.0.1                                                                                

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions