Azure / Azure/azure-powershell

The '-DefaultProfile' parameter are not supported by some cmdlets but are presented

Open
#21,688 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

Cmdlets are generated by autorest.powershell provides the parameter `-DefaultProfile`, which actually are not functional actually.
And below are some **workarounds**.

1. You use may `set-azcontext` to switch the context instead of using `-DefaultProfile`.
2. If you just need to specify the subscription. you may use the `-SubscriptionId` parameters, which are supported by those autogen cmdlets.

Steps that will be taken considering removing those un-functional `-DefaultProfile` are breaking changes even if they are not functional
1. Add a warning message when `-DefaultProfile` is used to tell users the parameter is not functional and will be removed
2. Remove those `-DefaultProfile`
3. Add them back if `-DefaultProfile` is supported by the generator autorest.powershell.

[Link](https://github.com/Azure/autorest.powershell/issues/1143) to the feature request in autorest.powershell.

### Issue script & Debug output

```PowerShell
None
```

### Environment data

```PowerShell
None
```

### Module versions

```PowerShell
The bug happens in all generated cmdlets.
```

### Error output

```PowerShell
None
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the generated cmdlets and the linked autorest.powershell feature request (issue 1143) to determine generator support for -DefaultProfile. Done means unsupported parameters warn before removal, supported ones can be restored, and the breaking-change sequence is handled across generated cmdlets.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.