Azure / Azure/azure-powershell
Connect-AzAccount doesn't take -AuthScope with -AccessToken
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
- We use `Connect-AzAccount` in an environment, where we only have an access token.
- User can't login interactively and no credentials are available. Thus, we can' use `-Credential` as well.
- But we have to use data plane cmdlets of `Az.Attestation`, which requires us to use `-AuthScope Attestation` with `Connect-AzAccount`. Here is how our cmdlet looks like `Connect-AzAccount -AuthScope Attestation -AccessToken -`.
- But above invocation doesn't work since `-AccessToken` and `-AuthScope` can't be used together in same parameter set.
- This poses a blocker for us since we only have an access token for connecting to Azure.
Our questions:
- Why are `-AccessToken` and `-AuthScope` mutually exclusive?
- What is our alternative? We can' use interactive authentication or `-Credential` as well.
### Issue script & Debug output
```PowerShell
Not providing due to sensitive nature of logs. Let me know if they are absolutely needed.
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 5.1.25398.469
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.25398.469
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
### Module versions
```PowerShell
2.13.1 Az.Accounts
6.11.2 Az.Resources
2.0.0 Az.Attestation
```
### Error output
```PowerShell
Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
```
Contributor guide
Research direction
Start with the Connect-AzAccount entry point in Az.Accounts and inspect how its parameter sets handle -AuthScope and -AccessToken. Reproduce the reported parameter-binding error using the documented invocation and module versions, then verify that the resulting connection supports Az.Attestation data-plane cmdlets with -AuthScope Attestation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- authentication, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100