Conversation
|
@microsoft-github-policy-service agree company="Microsoft" |
| case PowerBIProfileType.Certificate: | ||
| return await this.Authenticate(profile.UserName, profile.Thumbprint, profile.Environment, logger, settings); | ||
| case PowerBIProfileType.BringYourOwnToken: | ||
| return new PowerBIAccessToken { AccessToken = profile.AccessToken, }; |
There was a problem hiding this comment.
Is it enough for customer? On the other hand, we return what has been passed in.
src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a new authentication option to Connect-PowerBIServiceAccount that allows callers to supply their own JWT access token, propagating it through the profile/authentication flow so subsequent API calls can use it.
Changes:
- Introduces a new
BringYourOwnTokenparameter set with-TokenonConnect-PowerBIServiceAccount, including JWT lifetime validation. - Extends profile/authentication abstractions (
IPowerBIProfile,PowerBIProfileType,AuthenticationFactorySelector) to support a BYOT login type. - Updates help documentation and adds unit tests for token-format/expiry validation and parameter-set binding behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md | Documents the new -Token parameter set and adds an example. |
| src/Modules/Profile/Commands.Profile/GetPowerBIAccessToken.cs | Minor whitespace cleanup. |
| src/Modules/Profile/Commands.Profile/ConnectPowerBIServiceAccount.cs | Adds BYOT parameter set and JWT validation prior to creating a profile. |
| src/Modules/Profile/Commands.Profile.Test/ConnectPowerBIServiceAccountTests.cs | Adds tests covering malformed/expired/valid tokens and invalid parameter combinations. |
| src/Common/Common.Abstractions/PowerBIProfileType.cs | Adds BringYourOwnToken enum value. |
| src/Common/Common.Abstractions/PowerBIProfile.cs | Adds AccessToken storage and a BYOT constructor. |
| src/Common/Common.Abstractions/Interfaces/IPowerBIProfile.cs | Adds AccessToken to the profile interface. |
| src/Common/Commands.Common/Commands.Common.csproj | Adds Microsoft.IdentityModel.JsonWebTokens dependency. |
| src/Common/Commands.Common/AuthenticationFactorySelector.cs | Adds BYOT handling in Authenticate(profile, ...). |
| src/Common/Commands.Common.Test/TestProfile.cs | Implements new AccessToken property required by IPowerBIProfile. |
| Directory.Packages.props | Centrally pins Microsoft.IdentityModel.JsonWebTokens version. |
| .editorconfig | Enables trimming trailing whitespace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md
Outdated
Show resolved
Hide resolved
|
|
||
| ### Example 5 | ||
| ```powershell | ||
| PS C:\> Connect-PowerBIServiceAccount -Token eyJhbGciOiJIUzI1NiJ9.eyJ0ZXN0X2NsYWltIjp0cnVlLCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSIsImV4cCI6MjcxNzQ0Njc4NSwiaWF0IjoxNzcwNzE4Nzg1fQ.nOXgwieIpeFB9Svxxt6Z4_RkWVWSiVJcxbBzlPTaQJQ |
There was a problem hiding this comment.
The example includes a full JWT-like token inline. Even if it’s a dummy token, it’s safer to either clearly label it as fake and/or truncate/redact it to discourage copying secrets into command history.
| PS C:\> Connect-PowerBIServiceAccount -Token eyJhbGciOiJIUzI1NiJ9.eyJ0ZXN0X2NsYWltIjp0cnVlLCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSIsImV4cCI6MjcxNzQ0Njc4NSwiaWF0IjoxNzcwNzE4Nzg1fQ.nOXgwieIpeFB9Svxxt6Z4_RkWVWSiVJcxbBzlPTaQJQ | |
| PS C:\> Connect-PowerBIServiceAccount -Token eyJhbGciOiJIUzI1NiJ9.fake_payload_and_signature_redacted_for_example |
src/Modules/Profile/Commands.Profile/ConnectPowerBIServiceAccount.cs
Outdated
Show resolved
Hide resolved
src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md
Outdated
Show resolved
Hide resolved
src/Modules/Profile/Commands.Profile/ConnectPowerBIServiceAccount.cs
Outdated
Show resolved
Hide resolved
src/Modules/Profile/Commands.Profile/ConnectPowerBIServiceAccount.cs
Outdated
Show resolved
Hide resolved
src/Modules/Profile/Commands.Profile.Test/ConnectPowerBIServiceAccountTests.cs
Outdated
Show resolved
Hide resolved
Minimum allowed line rate is |
Provide an option to bring your own token for authentication