Skip to content

The authentication with username and password in the command line is not supported with MFA. #165

@Frank-Geisler

Description

@Frank-Geisler

Problem description

If you have MFA turned on you can not login through Command Line via user and password. Although this is an expected behaviour this will not be possible in the future anyway because MFA will be gradually enforced from 1th of September 2025. Question is if we throw out this option in our module because it will not be supported in the future anyway

Image

Verbose logs

WARNING: Starting September 1, 2025, MFA will be gradually enforced for Azure public cloud. The authentication with username and password in the command line is not supported with MFA. Consider using one of the compatible authentication methods. For more details, see https://go.microsoft.com/fwlink/?linkid=2276971
WARNING: You may need to login again after updating "EnableLoginByWam".
Connect-AzAccount: Authentication failed against tenant xxxxxx-xxxx-xxxx-xxxxx. User interaction is required. This may be due to the conditional access policy settings such as multi-factor authentication (MFA). If you need to access subscriptions in that tenant, please rerun 'Connect-AzAccount' with additional parameter '-TenantId 7669aae2-cc56-4fd1-abbb-60e446431a7b'.
Could not find tenant id for provided tenant domain 'xxxxxx-xxxx-xxxx-xxxxx'. Please ensure that the provided user is found in the provided tenant domain.

How to reproduce

$UserName = '[email protected]'
$UserPassword = '********'
$TenantID = 'xxxx-xxxx-xxxx-xxxx'

$SecureUserPassword = ConvertTo-SecureString $UserPassword -AsPlainText
-Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential
-ArgumentList $UserName,
$SecureUserPassword

Connect-AzAccount -Tenant $TenantId
-Credential $cred

Expected behavior

Should log in

Current behavior

Does not log in but this is by design.

Suggested solution

Throw out this option as this will be deprecated in the future anyway

Operating system you are running FabricTools on

OsName               : Microsoft Windows 11 Business
OsOperatingSystemSKU : 48
OsArchitecture       : 64-Bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : de-DE
OsMuiLanguages       : {de-DE, en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module version used

Name        Version Path
----        ------- ----
FabricTools 0.30.0  C:\Users\fgeisler\OneDrive - GDS Business Intelligence GmbH\Dokumente\PowerShell\Modules\FabricTools\0.30.0\FabricTools.psd1
FabricTools 0.29.0  C:\Users\fgeisler\OneDrive - GDS Business Intelligence GmbH\Dokumente\PowerShell\Modules\FabricTools\0.29.0\FabricTools.psd1
FabricTools 0.10.0  C:\Users\fgeisler\OneDrive - GDS Business Intelligence GmbH\Dokumente\PowerShell\Modules\FabricTools\0.10.0\FabricTools.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectFlaw or imperfection, affecting functionality, but a function can be usedquestionFurther information is requested

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions