Automate connection , PowerShell to Azure SQL PaaS using Azure AD account with MFA

Aman Garg 36 Reputation points
2022-12-15T10:42:11.277+00:00

Need to Automate connection for PowerShell to Azure SQL PaaS using Azure AD account (with MFA).

We have a AD account which is MFA enabled and need to use the account in PowerShell script and automate it further. Is it possible ?

Azure SQL Database
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Nandan Hegde 36,146 Reputation points MVP Volunteer Moderator
    2022-12-15T11:32:18.517+00:00

    Hey,
    for automation , which offering would you be using?
    Is it Azure automation, Azure function etc or local powershell?
    If you are using Azure offerings, better way would be to use managed identity to access it in automation.
    According to me Azure AD account with MFA cannot be used for automation purpose and there needs to a manual intervention every time a job executed.

    Switch to either Service principal auth to Managed identity

    0 comments No comments

  2. Limitless Technology 44,746 Reputation points
    2022-12-16T08:38:25.297+00:00

    Hi,

    Thank you for posting your query.

    Kindly follow the steps provided below to resolve your issue.

    This article shows you how to create and populate an Azure Active Directory (Azure AD) instance, and then use Azure AD with Azure SQL Database, Azure SQL Managed Instance, and Azure Synapse Analytics. For an overview, see Azure Active Directory authentication.

    Go to this link for your reference and other troubleshooting procedures https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure#using-an-azure-ad-identity-to-connect-from-a-client-application

    Do not hesitate to message us if you need further assistance.

    If the answer is helpful kindly click "Accept as Answer" and up vote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.