Home
%3CLINGO-SUB%20id%3D%22lingo-sub-1062991%22%20slang%3D%22en-US%22%3ETroubleshooting%20problems%20related%20to%20Azure%20AD%20authentication%20with%20Azure%20SQL%20DB%20and%20DW%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1062991%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20working%20with%20Azure%20AD%20authentication%20for%20Azure%20SQL%20DB%20and%20DW%2C%20you%20may%20sometimes%20encounter%20certain%20issues.%20The%20table%20below%20contains%20some%20of%20the%20Azure%20AD%20authentication%20problems%20that%20may%20appear%20when%20accessing%20SQL%20DB%2FDW%2C%20as%20well%20as%20how%20to%20troubleshoot%20them.%20%3CBR%20%2F%3EPlease%20note%20that%20this%20document%20is%20subject%20to%20be%20updated%20as%20we%20detect%20other%20issues%20in%20this%20area.%3C%2FP%3E%0A%3CTABLE%20width%3D%22696%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3E%3CSTRONG%3EProblem%20description%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3E%3CSTRONG%3ETroubleshooting%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ETo%20download%20the%20latest%3C%2FP%3E%0A%3CP%3EMicrosoft%20Active%20Directory%20Authentication%20Library%20(ADAL.dll)%2C%20install%20the%20latest%20SSMS%2C%20ODBC%20or%2C%20OLEDB%20driver%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EDownload%20links%20to%20install%20latest%20SSMS%2C%20ODCB%20and%20OLEDB%20driver%20that%20contain%20ADAL.dll%20library%3C%2FP%3E%0A%3CP%3E1)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fsql%2Fssms%2Fdownload-sql-server-management-studio-ssms%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDownload%20SQL%20Server%20Management%20Studio%20(SSMS)%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E2)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56567%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDownloading%20ODBC%20driver%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E3)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56730%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDownload%20OLEDB%20driver%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E2%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EService%20principal%20or%20application%20is%20not%20able%20to%20connect%20to%20SQL%20DB%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EThe%20C%23%20code%20below%20allows%20you%20to%20troubleshoot%20this%20problem%20in%20two%20steps%3A%3C%2FP%3E%0A%3CP%3E1)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Obtain%20an%20Azure%20AD%20token%3C%2FP%3E%0A%3CP%3E2)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Pass%20this%20token%20to%20SQL%20DB%3C%2FP%3E%0A%3CP%3EIf%20needed%2C%20the%20encrypted%20user%20token%20can%20also%20be%20available%20to%20the%20support%20team%20(see%20the%20blog%20below)%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-SQL-Database%2FAzure-AD-Service-Principal-authentication-to-SQL-DB-Code-Sample%2Fba-p%2F481467%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-SQL-Database%2FAzure-AD-Service-Principal-authentication-to-SQL-DB-Code-Sample%2Fba-p%2F481467%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E3%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ENot%20able%20to%20connect%20to%20SQL%20DB%20using%20an%20Azure%20AD%20user.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EUse%20the%20following%20guideline%20for%20troubleshooting%20this%20issue.%3C%2FP%3E%0A%3CP%3ESee%20the%20section%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENot%20able%20to%20connect%20using%20an%20Azure%20AD%20user-%20troubleshooting%20guideline%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E4%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ELogin%20fails%20when%20using%20%3CBR%20%2F%3EAzure%20AD%20OAuth2%20(MSAL)%3CBR%20%2F%3Eto%20get%20a%20token%20and%20connect%20to%20SQL%20DB%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3ECurrently%20when%20using%20Oauth2%2C%20the%20scope%20must%20be%20set%20as%20below%3C%2FP%3E%0A%3CP%3E%22scope%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fdatabase.windows.net%2F.default%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdatabase.windows.net%2F%2F.default%3C%2FA%3E%22%2C%20note%20%22%2F%2F%22%20here.%3C%2FP%3E%0A%3CP%3EThis%20is%20a%20known%20issue%20that%20will%20be%20fixed%20in%20the%20future.%20Once%20the%20fix%20is%20available%2C%20we%20will%20update%20this%20entry%20indicating%20the%20right%20%E2%80%9Cscope%E2%80%9D%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E5%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ELogin%20fails%20for%20Azure%20Active%20Directory%20Integrated%20authentication%20(single%20sign-on)%20due%20to%20missing%20WS-Trust%20endpoint%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EWhen%20using%20Azure%20Active%20Directory%20Integrated%20(single%20sign-on)%20authentication%20with%20SQL%20DB%2C%20the%20following%20error%20may%20appear%20due%20to%20network%20configuration%3A%3C%2FP%3E%0A%3CP%3ECould%20not%20discover%20endpoint%20for%20Integrated%20Windows%20Authentications.%20Check%20your%20ADFS%20setting.%20It%20should%20support%20Integrated%20Windows%20Authentication%20for%20WS-Trust%201.3%20or%20WS-Trust%202005%20(System%20Data).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAsk%20your%20network%20administrator%20to%20enable%20the%20WS-Trust%20endpoint%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E6%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EUnable%20to%20connect%20using%20Azure%20Authentication%20Password%20when%20an%20Azure%20AD%20user%20is%20setup%20for%20multi-factor%20authentication%20(MFA)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EThis%20is%20by%20design.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20authenticating%20in%20SSMS%20using%20Azure%20Active%20Directory%20Password%20or%20Azure%20Active%20Directory%20Integrated%20authentication%20for%20an%20Azure%20AD%20user%20setup%20for%20MFA%2C%20the%20following%20error%20occurs%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAADSTS50079%3A%20Due%20to%20a%20configuration%20change%20made%20by%20your%20administrator%2C%20or%20because%20you%20moved%20to%20a%20new%20location%2C%20you%20must%20enroll%20in%20multi-factor%20authentication%20to%20access%20%E2%80%A6%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20solve%20the%20problem%2C%20the%20authentication%20method%20%E2%80%9CAzure%20Active%20Directory%20-%20Universal%20with%20MFA%20support%E2%80%9D%20must%20be%20used.%3C%2FP%3E%0A%3CP%3EFor%20non-SSMS%20access%2C%20see%20below%20for%20a%20C%23%20code%20sample%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Factive-directory-interactive-connect-azure-sql-db%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSTRONG%3EConnect%20to%20Azure%20SQL%20Database%20with%20Azure%20Multi-Factor%20Authentication%3C%2FSTRONG%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E7%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EGuest%20user%20login%20not%20working%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EAzure%20AD%20user%20setting%20for%20external%20collaboration%20in%20the%20directory%20restricts%20guest%20users%20in%20this%20directory.%20Users%20are%20allowed%20in%20the%20directory%2C%20but%20general%20user%20setup%20may%20prevent%20adding%20guest%20users%20or%20limit%20their%20abilities.%3C%2FP%3E%0A%3CP%3ESee%20the%20section%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EGrant%20Azure%20AD%20permission%20rights%20to%20guest%20users%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E8%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ENot%20able%20to%20add%20Azure%20AD%20admin%20for%20SQL%20DB%20from%20portal%20as%20%3CSTRONG%3Eserver_name%3C%2FSTRONG%3E%20is%20invalid%20since%20it%20contains%20upper%20case%20letters%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EThis%20is%20a%20known%20issue%20that%20will%20be%20fixed%20in%20the%20future.%20Once%20the%20fix%20is%20available%2C%20we%20will%20update%20this%20entry.%3C%2FP%3E%0A%3CP%3ETo%20mitigate%20this%2C%20execute%20the%20following%20ARM-based%20PowerShell%20script%3C%2FP%3E%0A%3CP%3Eto%20add%20an%20Azure%20AD%20admin.%3C%2FP%3E%0A%3CP%3ESee%20the%20section%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENot%20able%20to%20add%20Azure%20AD%20admin%20from%20portal%20-%20invalid%20server%20name%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E9%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3ENot%20finding%20Azure%20SQL%20Database%20application%20in%20Azure%20AD%20Portal%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EThis%20is%20a%20known%20issue.%3C%2FP%3E%0A%3CP%3EAdd%20%E2%80%9CAzure%20SQL%20DB%E2%80%9D%20application%20manually%20into%20a%20customer%20tenant.%3CBR%20%2F%3EIt%20requires%20an%20Azure%20AD%20admin%20permission%20on%20the%20tenant.%3C%2FP%3E%0A%3CP%3ESee%20the%20section%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAdd%20an%20Azure%20SQL%20DB%20application%20manually%20into%20Azure%20AD%20tenant%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E10%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EService%20principal%20not%20able%20to%20create%20a%20new%20Azure%20AD%20user%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3ECurrently%2C%20this%20operation%20is%20not%20supported.%20To%20help%20us%20evaluate%3C%2FP%3E%0A%3CP%3Ethis%20feature%20request%2C%20please%20add%20your%20comments%20to%20the%20blog%20indicated%20below%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Ffeedback.azure.com%252Fforums%252F169401-azure-active-directory%252Fsuggestions%252F39176089-support-service-principal-impersonation-so-that-sp%26amp%3Bdata%3D02%257C01%257Cmireks%2540microsoft.com%257Cab76cf7202064164b04708d778273be0%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637109982300661462%26amp%3Bsdata%3Dszbq2mxof22cId810CTA47mkR0G5LgW93ElLSYtiPJM%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ffeedback.azure.com%2Fforums%2F169401-azure-active-directory%2Fsuggestions%2F39176089-support-service-principal-impersonation-so-that-sp%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E11%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EUnable%20to%20create%20new%20SQL%20user%20when%20creating%20a%20guest%20user%20in%20Azure%20AD%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3EThis%20is%20currently%20not%20supported.%20To%20create%20an%20Azure%20AD%20guest%20user%20in%20SQL%20DB%2C%20a%20guest%20user%20must%20be%20part%20of%20an%20Azure%20AD%20group%20that%20is%20created%20as%20a%20SQL%20user.%3C%2FP%3E%0A%3CP%3EThe%20same%20applies%20when%20setting%20up%20an%20Azure%20AD%20guest%20user%20as%20an%20Azure%20AD%20admin%20for%20SQL%20Server.%20Guest%20user%20must%20be%20part%20of%20an%20Azure%20AD%20group%20that%20can%20be%20setup%20as%20a%20SQL%20Azure%20AD%20admin.%3C%2FP%3E%0A%3CP%3EWe%20are%20working%20on%20the%20fix%20for%20allowing%20guest%20users%20to%20be%20added%20individually%2C%20and%20not%20as%20part%20of%20a%20group%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E12%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EUnable%20to%20create%20user%20from%20external%20provider%3A%20principal%20cannot%20be%20resolved%20because%20of%20Azure%20AD%20Conditional%20Access%20(CA)%20policy%20admin%20configurations%20or%20%3CSPAN%3Echanged%20location%20require(s)%20re-enrollment%20in%20MFA.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EError%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPrincipal%20'user1%40aadoutlook.onmicrosoft.com'%20could%20not%20be%20resolved.%20Error%20message%3A%20%E2%80%A6.AADSTS50079%3A%20Due%20to%20a%20configuration%20change%20made%20by%20your%20administrator%2C%20or%20because%20you%20moved%20to%20a%20new%20location%2C%20you%20must%20enroll%20in%20multi-factor%20authentication%20to%20access%20'00000002-0000-0000-c000-000000000000'%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETry%20using%20MFA%20to%20sign%20into%20SQL%2C%20then%20try%20again.%20If%20that%20does%20not%20work%2C%20contact%20your%20Azure%20AD%20admin%20to%20change%20CA%20policies%20and%20allow%20traffic%20to%20the%20Application%20ID.%3CBR%20%2F%3ESee%20the%20section%20below%3A%3CBR%20%2F%3E%3CSTRONG%3EExamples%20of%20Conditional%20Access%20application%20policies%20preventing%20or%20blocking%20access%20to%20create%20Azure%20AD%20users%20from%20external%20provider%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2248%22%3E%3CP%3E13%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22204%22%3E%3CP%3EUnable%20to%20create%20user%20from%20external%20provider%3A%20principal%20cannot%20be%20resolved%20because%20access%20is%20denied%20due%20to%20CA%20policy%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22444%22%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20%23ffffff%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20display%3A%20inline%3B%20float%3A%20none%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EError%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPrincipal%20'user1%40aadoutlook.onmicrosoft.com'%20could%20not%20be%20resolved.%20Error%20message%3A%20AADSTS53003%3A%20Blocked%20by%20conditional%20access%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EContact%20your%20Azure%20AD%20admin%20to%20change%20CA%20policies%20and%20allow%20traffic%20to%20the%20Application%20ID.%20Azure%20Active%20Directory%20admin%20has%20created%20CA%20policies%2C%20but%20these%20block%20the%20connection%20outright.%3C%2FP%3E%0A%3CP%3ESee%20the%20section%20below%3A%3CBR%20%2F%3E%3CSTRONG%3EExamples%20of%20Conditional%20Access%20application%20policies%20preventing%20or%20blocking%20access%20to%20create%20Azure%20AD%20users%20from%20external%20provider%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3E%3CSTRONG%3ENot%20able%20to%20connect%20using%20an%20Azure%20AD%20user-%20troubleshooting%20guideline%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EObtain%20Fiddler%20traces%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EDownload%20Fiddler%20from%20here%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fwww.telerik.com%252Fdownload%252Ffiddler%26amp%3Bdata%3D02%257C01%257CAmol.Agarwal%2540microsoft.com%257C223bdb9a23b44a4f943f08d74da84a23%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637063257518116728%26amp%3Bsdata%3Dts5MC%252FRIIUWc5dC67PYcUkvg7ysxgwE8WrK87xGM73I%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.telerik.com%2Fdownload%2Ffiddler%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E(*)%20Disclaimer%3A%20use%20of%20this%20tool%20is%20a%20recommendation%20to%20help%20troubleshoot%20and%20is%20not%20administered%20by%20%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Microsoft.%20Please%20use%20at%20your%20own%20risk.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3EInstall%20Fiddler%20and%20add%20a%20root%20certificate.%3C%2FLI%3E%0A%3CLI%3ESetup%20a%20%E2%80%9CFiddler%20Trace%E2%80%9D%20with%20%E2%80%9CDecrypt%20HTTPS%20Traffic%E2%80%9D%20option%20checked%20in%20%5BTools-%26gt%3BOptions-%26gt%3BHTTPS%5D.%3C%2FLI%3E%0A%3CLI%3ELaunch%20SSMS%3C%2FLI%3E%0A%3CLI%3ELogin%20with%20an%20Azure%20AD%20credential%3C%2FLI%3E%0A%3CLI%3EStop%20capture%20in%20Fiddler%20traces%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3E%26nbsp%3B%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EDebug%20Fiddler%20Trace%3F%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%20the%20Fiddler%20trace.%3C%2FLI%3E%0A%3CLI%3ELook%20for%20a%20call%20to%20Host%20%E2%80%9C%3CSTRONG%3Ewindows.net%3C%2FSTRONG%3E%E2%80%9D%20or%20%E2%80%9C%3CSTRONG%3Elogin.microsoftonline.com%3C%2FSTRONG%3E%E2%80%9D%20in%20the%20left%20pane.%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20frame%20and%20look%20to%20the%20right.%20The%20upper%20panel%20contains%20the%20request.%20You%20can%20expand%20the%20request%20by%20clicking%20on%20%E2%80%9C%3CSTRONG%3ERaw%3C%2FSTRONG%3E%E2%80%9D%20and%20view%20the%20request%20packet%20being%20sent%20to%20Azure%20AD.%3C%2FLI%3E%0A%3CLI%3ELook%20for%20the%20corresponding%20response%20value.%20The%20responses%20from%20Azure%20AD%20are%20usually%20very%20specific%20and%20will%20help%20guide%20the%20customer%20on%20what%20is%20missing%20in%20the%20authentication%20request%20(e.g.%20%22error%22%3A%22interaction_required%22%2C%22error_description%3A%20%3CSTRONG%3EAADSTS50079%3C%2FSTRONG%3E.%20The%20user%20is%20required%20to%20use%20multi-factor%20authentication%E2%80%A6%E2%80%A6).%3C%2FLI%3E%0A%3CLI%3EIf%20the%20Fiddler%20trace%20contains%20a%20%E2%80%9C%3CSTRONG%3Eseemingly%20legitimate%3C%2FSTRONG%3E%E2%80%9D%20access%20token%2C%20copy%20the%20token%20from%20the%20trace%20and%20debug%20it.%20Please%20note%20that%20a%20valid%20token%20could%20reveal%20user%20information%20and%20is%20a%20subject%20for%20the%20privacy%20compliance%2C%20therefore%20before%20debugging%20it%20wait%20for%20the%20token%20to%20expire.%20If%20needed%2C%20before%20sharing%20this%20token%20with%20support%20team%20to%20continue%20working%20on%20the%20problem%2C%20make%20sure%20that%20the%20token%20does%20not%20contain%20relevant%20user%20information.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EDebug%20Azure%20AD%20Token%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ECopy%20the%20Azure%20AD%20access%20token.%3C%2FLI%3E%0A%3CLI%3EOpen%20a%20browser%20of%20your%20choice%20and%20go%20to%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fjwt.io%252F%26amp%3Bdata%3D02%257C01%257CAmol.Agarwal%2540microsoft.com%257C223bdb9a23b44a4f943f08d74da84a23%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637063257518126731%26amp%3Bsdata%3DzcOA8fX1gKT3blXkY%252Brk3uKM1fYEIdVRPH91EXSf01Q%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjwt.io%2F%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(*)%20Disclaimer%3A%20this%20is%20only%20a%20recommendation%20and%20opening%20this%20link%20is%20not%20required%20nor%20owned%20by%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Microsoft.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3EPaste%20the%20token%20in%20the%20following%20box%3A%3C%2FLI%3E%0A%3CLI%3EThis%20will%20display%20ObjectID%20and%20groups%20information.%3COL%3E%0A%3CLI%3EUse%20ObjectID%20if%20a%20user%20is%20individually%20added%20to%20the%20server%2C%20or%3C%2FLI%3E%0A%3CLI%3EUse%20Guids%20in%20groups%20if%20a%20user%20is%20logged%20in%20as%20a%20member%20of%20the%20group.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3E%26nbsp%3B%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EObtain%20an%20ObjectID%20of%20the%20user%20or%20group%20trying%20to%20login.%20%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%20This%20information%20can%20be%20obtained%20from%20the%20Azure%20AD%20portal%20for%20a%20user%20or%20group%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%20(see%20a%20screenshot%20below%2C%20indicating%20in%20red%20an%20Azure%20AD%20ObjectID%3A%2025c8820a-xxxx-xxxx-xxxx-fe2fd9%3CSTRONG%3E%3CFONT%20color%3D%22%230000ff%22%3E14e144%3C%2FFONT%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%3C%2FSTRONG%3Efor%20user1%40sqlxxx.onmicrosoft.com)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20774px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161520i4011415FF0A05044%2Fimage-dimensions%2F774x522%3Fv%3D1.0%22%20width%3D%22774%22%20height%3D%22522%22%20alt%3D%22Capture10.PNG%22%20title%3D%22Capture10.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EObtain%20a%20SID%20from%20Azure%20SQL%20DB%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ELogin%20to%20a%20database%20and%20execute%20a%20SELECT%20statement%20from%20sys.database_principals%20to%20find%20the%20right%20SID%20for%20a%20given%3C%2FP%3E%0A%3CP%3EAzure%20AD%20user%20or%20a%20group.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EUsing%20the%20example%20above%20for%20Azure%20AD%20user1%40sqlxxx.onmicrosoft.com%2C%20the%20following%20SID%20is%20derived%20from%20the%20below%20SELECT%20statement%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3Eselect%20name%2C%20type%2C%20type_desc%2C%20SID%20from%20%3CSTRONG%3Esys.database_principals%3C%2FSTRONG%3E%20where%20name%3D%3CSTRONG%3E'user1%40sqlxxx.onmicrosoft.com'%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOutput%3C%2FP%3E%0A%3CP%3Ename%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20type%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20type_desc%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SID%3C%2FP%3E%0A%3CP%3Euser1%40sqlxxx.onmicrosoft.com%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20EXTERNAL_USER%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x0XXXXXXXXXFE2FD9%3CFONT%20color%3D%22%230000ff%22%3E%3CSTRONG%3E14E144%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECompare%20the%20ObjectID%20and%20SID%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20last%20six%20digits%20for%20these%20two%20should%20match.%20If%20not%2C%20there%E2%80%99s%20is%20a%20mismatch%20between%20a%20user%20registered%20in%20Azure%20AD%20and%20an%20Azure%20AD%20user%20created%20in%20SQL%20DB.%20This%20mismatch%20has%20to%20be%20resolved.%3C%2FP%3E%0A%3CP%3EBased%20on%20the%20example%20above%20for%20user1%40sqlxxx.onmicrosoft.com%2C%20the%20last%206%20digits%20for%20the%20%3CSTRONG%3EObjectID%3C%2FSTRONG%3E%20in%20Azure%20AD%2C%20and%20the%20last%20six%20digits%20for%20the%20%3CSTRONG%3ESID%3C%2FSTRONG%3E%26nbsp%3B%20match%20and%20represent%20the%20same%20user%20(see%20the%206%20digits%20%3CSTRONG%3E%3CFONT%20color%3D%22%230000ff%22%3E14E144%20%3C%2FFONT%3E%3C%2FSTRONG%3Eindicated%20in%20%3CFONT%20color%3D%22%230000ff%22%3Eblue%3C%2FFONT%3E).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3EObtain%20SQL%20connection%20id%20%3C%2FU%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fsql-azure-and-session-tracing-id%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fsql-azure-and-session-tracing-id%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CU%3E%26nbsp%3B%3C%2FU%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3E%3CSTRONG%3EGrant%20Azure%20AD%20permission%20rights%20to%20guest%20users%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReview%20the%20Azure%20portal%20snapshot%20for%20User%20setting%20-%20External%20collaboration%20setting%20(see%20below).%20%3CBR%20%2F%3EThe%20current%20setting%20below%20prevents%20guest%20users%20to%20execute%20certain%20directory%20tasks.%3CBR%20%2F%3ETo%20remove%20this%20limitation%20the%20current%20setting%20(in%20the%20red%20circle)%20must%20be%20changed%20to%20NO.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20735px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161458iEC6EAAEA41D9D142%2Fimage-dimensions%2F735x634%3Fv%3D1.0%22%20width%3D%22735%22%20height%3D%22634%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-357486355%22%20id%3D%22toc-hId-357486355%22%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%226%22%3ENot%20able%20to%20add%20Azure%20AD%20admin%20from%20portal%20-%20invalid%20server%20name%3C%2FFONT%3E%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20following%20PowerShell%20script%20using%20ARM%20interface%20can%20be%20used%20to%20mitigate%20this%20problem.%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20this%20script%20can%20also%20be%20used%20to%20set%20up%20an%20Azure%20AD%20admin%20for%20SQL%20DB%20in%20normal%20conditions%3C%2FP%3E%0A%3CP%3E(the%20required%20impute%20parameters%20in%20this%20script%20are%20indicated%20in%20%3CSTRONG%3E%3CFONT%20color%3D%22%230000ff%22%3Eblue%3C%2FFONT%3E%3C%2FSTRONG%3E).%3C%2FP%3E%0A%3CP%3EIn%20addition%2C%20this%20script%20can%20be%20used%20to%20set%20up%20an%20Azure%20AD%20admin%20for%20SQL%20DB%20in%20case%20an%20admin%20is%20a%20Service%20Principal.%3C%2FP%3E%0A%3CP%3ECurrently%2C%20the%20Azure%20portal%20search%20blade%20displays%20the%20Service%20Principals%20for%20the%20admin%20setup.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EImport-Module%20Azure%3C%2FP%3E%0A%3CP%3E%24tenantId%20%3D%20'%3CFONT%20color%3D%22%230000ff%22%3Exxxxxe29-xxxxc-4b64-90ac-287b977xxxxx%3C%2FFONT%3E'%3B%20%23%20%3CSTRONG%3Ethe%20tenant%20ID%20for%20the%20Azure%20AD%20directory%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24administratorType%3D%22ActiveDirectory%22%3B%3C%2FP%3E%0A%3CP%3E%24login%3D%22%3CFONT%20color%3D%22%230000ff%22%3Euser1%40aad.onmicrosoft.com%3C%2FFONT%3E%22%3B%20%23%20%3CSTRONG%3Ethe%20new%20Azure%20AD%20admin%20for%20SQL%20DB%20(user%20or%20group)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24sid%3D%22%3CFONT%20color%3D%22%230000ff%22%3E6ac4xxxx-d34c-4XX1-bb03-xxxxfb73xxxx%3C%2FFONT%3E%22%3B%23%20%3CSTRONG%3Ethe%20ObjectID%20of%20the%20new%20Azure%20AD%20admin%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24clientId%20%3D%20%22%3CFONT%20color%3D%22%230000ff%22%3E1950xxxx-xxxx-4e31-a9cf-xxxx9594xxxx%3C%2FFONT%3E%22%20%23%20%3CSTRONG%3EMicrosoft%20fixed%20client%20ID%3B%20do%20not%20change%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24subscriptionId%20%3D%20'%3CFONT%20color%3D%22%230000ff%22%3Exx77xxxx-a286-xxxx-b6f0-29c42acxxxx%3C%2FFONT%3E'%20%3CSTRONG%3E%23the%20server%20subscription%20ID%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24uri%20%3D%20%22urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob%22%3C%2FP%3E%0A%3CP%3E%24authUrl%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Flogin.windows.net%2F%24tenantId%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.windows.net%2F%24tenantId%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%24serverName%20%3D%20%22%3CFONT%20color%3D%22%230000ff%22%3ESQLxx%3C%2FFONT%3E%22%20%3CSTRONG%3E%23%20the%20server%20name%20only%20w%2Fo%20suffix%20database.windows.net%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%24resourceGroupName%3D%22%3CFONT%20color%3D%22%230000ff%22%3Esqlxxxx%3C%2FFONT%3E%22%20%3CSTRONG%3E%23%20the%20resource%20name%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELogin-AzureRmAccount%20-tenantId%20%24tenantId%3C%2FP%3E%0A%3CP%3E%24AuthContext%20%3D%20%5BMicrosoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext%5D%24authUrl%3C%2FP%3E%0A%3CP%3E%24result%20%3D%20%24AuthContext.AcquireToken(%22%3CA%20href%3D%22https%3A%2F%2Fmanagement.core.windows.net%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.core.windows.net%2F%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%24clientId%2C%3C%2FP%3E%0A%3CP%3E%5BUri%5D%24uri%2C%3C%2FP%3E%0A%3CP%3E%5BMicrosoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior%5D%3A%3AAuto)%3C%2FP%3E%0A%3CP%3E%24authHeader%20%3D%20%40%7B%3C%2FP%3E%0A%3CP%3E'Content-Type'%3D'application%5Cjson%3B%20'%3C%2FP%3E%0A%3CP%3E'Authorization'%3D%24result.CreateAuthorizationHeader()%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%24body%20%3D%20%40%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20properties%20%3D%20%40%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20administratorType%20%3D%20%24administratorType%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20login%20%3D%20%24login%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sid%20%3D%20%24sid%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20tenantId%20%3D%20%24tenantId%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%7D%3C%2FP%3E%0A%3CP%3E%7D%20%7C%20ConvertTo-Json%3C%2FP%3E%0A%3CP%3E%23%20Execute%20the%20following%20commands%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%23%20Display%20an%20old%20AAD%20admin%20%3C%2FSTRONG%3E(called%20%3CSTRONG%3EB2B%3C%2FSTRONG%3E%20in%20the%20example%20below)%3C%2FP%3E%0A%3CP%3EInvoke-RestMethod%20-Uri%20%22%3CA%20href%3D%22https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%3C%2FA%3E%22%20-Method%20GET%20-Headers%20%24authHeader%3B%3C%2FP%3E%0A%3CP%3E%5B%3CSTRONG%3Eoutput%5D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Eproperties%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20id----------%40%7BadministratorType%3DActiveDirectory%3B%20%3CSTRONG%3Elogin%3DB2B%3C%2FSTRONG%3E%3B%20sid%3D27xxxxxxx-c2xx-48xx-ac14-ff887xxxxxxx%3B%20tenantId%3D%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3Exxxxxe29-xxxxc-4b64-90ac-287b977xxxxx%3C%2FSPAN%3E%7D%20%2Fsubscriptions%2F%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3Exx77xxxx-a286-xxxx-b6f0-29c42acxxx%3C%2FSPAN%3E...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%23%20Change%20AAD%20admin%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(%20%3C%2FSTRONG%3Ein%20this%20example%20from%20B2B%20to%20user1%40aad.onmicrosoft.com%20)%3C%2FP%3E%0A%3CP%3EInvoke-RestMethod%20-Uri%20%22%3CA%20href%3D%22https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%3C%2FA%3E%22%20-Method%20PUT%20-Headers%20%24authHeader%20-Body%20%24body%20-ContentType%20%22application%2Fjson%22%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%5Boutput%5D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Eoperation%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20startTime%3CBR%20%2F%3E---------%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20---------%3CBR%20%2F%3EUpdateActiveDirectoryAdministrator%202019-11-22T19%3A37%3A38.777Z%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Estart-sleep%20-s%205%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%23%20Display%20a%20new%20AAD%20admin%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%23%3C%2FSTRONG%3E(%20in%20the%20example%20below%20a%20new%20Azure%20Ad%20admin%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3Euser1%40aad.onmicrosoft.com%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EInvoke-RestMethod%20-Uri%20%22%3CA%20href%3D%22https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%24subscriptionId%2FresourceGroups%2F%24resourceGroupName%2Fproviders%2FMicrosoft.Sql%2Fservers%2F%24serverName%2Fadministrators%2FActiveDirectory%3Fapi-version%3D2018-06-01-preview%3C%2FA%3E%22%20-Method%20GET%20-Headers%20%24authHeader%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%5Boutput%5D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Eproperties%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20id--------%3CBR%20%2F%3E%40%7BadministratorType%3DActiveDirectory%3B%20%3CSTRONG%3Elogin%3Duser1%40aad.onmicrosoft.com%3C%2FSTRONG%3E%3B%20sid%3D%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E6ac4xxxx-d34c-4XX1-bb03-xxxxfb73xxxx%3C%2FSPAN%3E%3B%20tenantId%3D%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3Exxxxxe29-xxxxc-4b64-90ac-287b977xxxx%3C%2FSPAN%3E%20%2Fsubscri...%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%226%22%3EAdd%20an%20Azure%20SQL%20DB%20application%20manually%20into%20Azure%20AD%20tenant%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%2FThis%20execution%20requires%20an%20Azure%20AD%20admin%20permission%20on%20the%20tenant%2F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%201.%3C%2FSTRONG%3E%3CBR%20%2F%3ECheck%20if%20the%20Azure%20SQL%20Database%20has%20already%20been%20added%20to%20the%20Azure%20AD%20directory%20(see%20below)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20737px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161459i32DDFA2CC6FA4640%2Fimage-dimensions%2F737x308%3Fv%3D1.0%22%20width%3D%22737%22%20height%3D%22308%22%20alt%3D%22clipboard_image_2.png%22%20title%3D%22clipboard_image_2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAzure%20SQL%20Database%20API%20permissions%20must%20also%20be%20part%20of%20created%20applications%3C%2FP%3E%0A%3CP%3EBelow%2C%20we%20indicate%20the%20API%20permissions%20required%20for%20a%20user%20created%20application%20permission%3C%2FP%3E%0A%3CP%3EGo%20to%20App%20registration-%26gt%3Bmyapp-%26gt%3B%20API%20my%20organization%20uses%2C%20and%20check%20if%20%E2%80%9CAzure%20SQL%20Database%E2%80%9D%20is%20listed%20for%20your%20tenant)%20allowing%20you%20to%20grant%20it%20the%20necessary%20permission%20(see%20below).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161523i172267FA68A7F3EB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.11.PNG%22%20title%3D%22Capture.11.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%202.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIn%20Case%20Azure%20SQL%20DB%20is%20not%20part%20of%20the%20tenant%2C%20the%20following%20two%20options%20can%20be%20used%20to%20add%20it%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOption%201%3A%20Execute%20one%20of%20the%20commands%20below%20comment%20to%20create%20an%20%E2%80%9C%3C%2FSTRONG%3EAzure%20SQL%20Database%E2%80%9D%3CSTRONG%3E%20application%20in%20the%20tenant%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EConnect-AzureAD%20-TenantId%20%22%5BThe%20tenant%20Id%5D%22%3C%2FLI%3E%0A%3CLI%3ENew-AzureADServicePrincipal%20-AppId%20%E2%80%9C022907d3-0f1b-48f7-badc-xxxxx%E2%80%9D%20%26nbsp%3B-DisplayName%20%E2%80%9CAzure%20SQL%20Database%E2%80%9D%3C%2FLI%3E%0A%3CLI%3ENew-AzureADServicePrincipal%20-AppId%20%E2%80%9C022907d3-0f1b-48f7-badc-xxxxx%3CBR%20%2F%3ENew-AzureADServicePrincipal%20%26nbsp%3B-DisplayName%20%E2%80%9CAzure%20SQL%20Database%E2%80%9D%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3EOption%202%3A%20Re-register%20for%20Microsoft.SQL%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ERegister%20a%20subscription%20for%20Microsoft.SQL%20by%20executing%20the%20command%20indicated%20below%20and%20retry.%3CUL%3E%0A%3CLI%3ERegister-AzResourceProvider%20-ProviderNamespaceSQL%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%226%22%3EExamples%20of%20Conditional%20Access%20(CA)%20application%20policies%20preventing%20or%20blocking%20access%20to%20create%20Azure%20AD%20users%20from%20external%20provider%3C%2FFONT%3E%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDefining%20MFA%20CA%20policy%20applying%20to%20all%20cloud%20apps%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20738px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161462i6BB0E0D92069AAB9%2Fimage-dimensions%2F738x889%3Fv%3D1.0%22%20width%3D%22738%22%20height%3D%22889%22%20alt%3D%22clipboard_image_4.png%22%20title%3D%22clipboard_image_4.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEven%20though%20%3CSTRONG%3EAzure%20SQL%20Database%3C%2FSTRONG%3E%20is%20excluded%20from%20application%20requiring%20MFA%20(see%20below)%2C%20an%20external%20Azure%20AD%20user%20cannot%20be%20created%20because%20the%20Azure%20AD%20graph%20API%20requires%20MFA%20(see%20also%20next%20snapshot).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20732px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161461iB2350D5ED32D15BD%2Fimage-dimensions%2F732x874%3Fv%3D1.0%22%20width%3D%22732%22%20height%3D%22874%22%20alt%3D%22clipboard_image_5.png%22%20title%3D%22clipboard_image_5.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnforcing%20CA%20(see%20below)%20is%20causing%20an%20error%3A%20%E2%80%9CPrincipal%20xxx%20could%20not%20be%20resolved.%20Error%20message%3A%20%3CSTRONG%3EAADSTS50079%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20734px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161465iADAF2310B9285968%2Fimage-dimensions%2F734x956%3Fv%3D1.0%22%20width%3D%22734%22%20height%3D%22956%22%20alt%3D%22clipboard_image_6.png%22%20title%3D%22clipboard_image_6.png%22%20%2F%3E%3C%2FSPAN%3E%3CI%3E%3C%2FI%3E%3CU%3E%3C%2FU%3E%3CSTRIKE%3E%3C%2FSTRIKE%3E%3C%2FP%3E%0A%3CP%3EIn%20the%20snapshot%20below%2C%20the%20CA%20policy%20blocks%20the%20connection%20outright%2C%20causing%20an%20error%3C%2FP%3E%0A%3CP%3E%E2%80%9CPrincipal%20xxx%20could%20not%20be%20resolved.%20Error%20message%3A%20%3CSTRONG%3EAADSTS53003%3C%2FSTRONG%3E%3A%20Blocked%20by%20conditional%20access%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20738px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F161464i3A974B2556FC48FC%2Fimage-dimensions%2F738x864%3Fv%3D1.0%22%20width%3D%22738%22%20height%3D%22864%22%20alt%3D%22clipboard_image_7.png%22%20title%3D%22clipboard_image_7.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1062991%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3ETroubleshooting%20problems%20related%20to%20Azure%20AD%20authentication%20with%20Azure%20SQL%20DB%20and%20DW%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1062991%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

   

When working with Azure AD authentication for Azure SQL DB and DW, you may sometimes encounter certain issues. The table below contains some of the Azure AD authentication problems that may appear when accessing SQL DB/DW, as well as how to troubleshoot them.
Please note that this document is subject to be updated as we detect other issues in this area.

 

Problem description

Troubleshooting

1

To download the latest

Microsoft Active Directory Authentication Library (ADAL.dll), install the latest SSMS, ODBC or, OLEDB driver

Download links to install latest SSMS, ODCB and OLEDB driver that contain ADAL.dll library

1)      Download SQL Server Management Studio (SSMS)

2)      Downloading ODBC driver

3)      Download OLEDB driver

 

2

Service principal or application is not able to connect to SQL DB

 

The C# code below allows you to troubleshoot this problem in two steps:

1)      Obtain an Azure AD token

2)      Pass this token to SQL DB

If needed, the encrypted user token can also be available to the support team (see the blog below)

https://techcommunity.microsoft.com/t5/Azure-SQL-Database/Azure-AD-Service-Principal-authentication-...

 

3

Not able to connect to SQL DB using an Azure AD user.

 

Use the following guideline for troubleshooting this issue.

See the section below:

Not able to connect using an Azure AD user- troubleshooting guideline

 

4

Login fails when using
Azure AD OAuth2 (MSAL)
to get a token and connect to SQL DB

 

Currently when using Oauth2, the scope must be set as below

"scope": "https://database.windows.net//.default", note "//" here.

This is a known issue that will be fixed in the future. Once the fix is available, we will update this entry indicating the right “scope”

5

Login fails for Azure Active Directory Integrated authentication (single sign-on) due to missing WS-Trust endpoint

 

 

When using Azure Active Directory Integrated (single sign-on) authentication with SQL DB, the following error may appear due to network configuration:

Could not discover endpoint for Integrated Windows Authentications. Check your ADFS setting. It should support Integrated Windows Authentication for WS-Trust 1.3 or WS-Trust 2005 (System Data).

 

Ask your network administrator to enable the WS-Trust endpoint

6

Unable to connect using Azure Authentication Password when an Azure AD user is setup for multi-factor authentication (MFA)

 

This is by design. 

When authenticating in SSMS using Azure Active Directory Password or Azure Active Directory Integrated authentication for an Azure AD user setup for MFA, the following error occurs:

AADSTS50079: Due to a configuration change made by your administrator, or because you moved to a new location, you must enroll in multi-factor authentication to access …

To solve the problem, the authentication method “Azure Active Directory - Universal with MFA support” must be used.

For non-SSMS access, see below for a C# code sample

Connect to Azure SQL Database with Azure Multi-Factor Authentication

 

7

Guest user login not working

 

Azure AD user setting for external collaboration in the directory restricts guest users in this directory. Users are allowed in the directory, but general user setup may prevent adding guest users or limit their abilities.

See the section below:

Grant Azure AD permission rights to guest users

 

8

Not able to add Azure AD admin for SQL DB from portal as server_name is invalid since it contains upper case letters  

 

This is a known issue that will be fixed in the future. Once the fix is available, we will update this entry.

To mitigate this, execute the following ARM-based PowerShell script

to add an Azure AD admin.

See the section below:

Not able to add Azure AD admin from portal - invalid server name

 

9

Not finding Azure SQL Database application in Azure AD Portal

 

This is a known issue.

Add “Azure SQL DB” application manually into a customer tenant.
It requires an Azure AD admin permission on the tenant.

See the section below:

Add an Azure SQL DB application manually into Azure AD tenant

 

10

Service principal not able to create a new Azure AD user

 

 

Currently, this operation is not supported. To help us evaluate

this feature request, please add your comments to the blog indicated below:

https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/39176089-support-service...

 

11

Unable to create new SQL user when creating a guest user in Azure AD

This is currently not supported. To create an Azure AD guest user in SQL DB, a guest user must be part of an Azure AD group that is created as a SQL user.

The same applies when setting up an Azure AD guest user as an Azure AD admin for SQL Server. Guest user must be part of an Azure AD group that can be setup as a SQL Azure AD admin.

We are working on the fix for allowing guest users to be added individually, and not as part of a group

 

12

Unable to create user from external provider: principal cannot be resolved because of Azure AD Conditional Access (CA) policy admin configurations or changed location require(s) re-enrollment in MFA. 

 

Error:

Principal 'user1@aadoutlook.onmicrosoft.com' could not be resolved. Error message: ….AADSTS50079: Due to a configuration change made by your administrator, or because you moved to a new location, you must enroll in multi-factor authentication to access '00000002-0000-0000-c000-000000000000'

 

Try using MFA to sign into SQL, then try again. If that does not work, contact your Azure AD admin to change CA policies and allow traffic to the Application ID.
See the section below:
Examples of Conditional Access application policies preventing or blocking access to create Azure AD users from external provider

 

13

Unable to create user from external provider: principal cannot be resolved because access is denied due to CA policy

 

Error:

Principal 'user1@aadoutlook.onmicrosoft.com' could not be resolved. Error message: AADSTS53003: Blocked by conditional access

 

Contact your Azure AD admin to change CA policies and allow traffic to the Application ID. Azure Active Directory admin has created CA policies, but these block the connection outright.

See the section below:
Examples of Conditional Access application policies preventing or blocking access to create Azure AD users from external provider

 

 

 

Not able to connect using an Azure AD user- troubleshooting guideline

 

Obtain Fiddler traces

  1. Download Fiddler from here https://www.telerik.com/download/fiddler

(*) Disclaimer: use of this tool is a recommendation to help troubleshoot and is not administered by
     Microsoft. Please use at your own risk.

  1. Install Fiddler and add a root certificate.
  2. Setup a “Fiddler Trace” with “Decrypt HTTPS Traffic” option checked in [Tools->Options->HTTPS].
  3. Launch SSMS
  4. Login with an Azure AD credential
  5. Stop capture in Fiddler traces

 

Debug Fiddler Trace?

  1. Open the Fiddler trace.
  2. Look for a call to Host “windows.net” or “login.microsoftonline.com” in the left pane.
  3. Select the frame and look to the right. The upper panel contains the request. You can expand the request by clicking on “Raw” and view the request packet being sent to Azure AD.
  4. Look for the corresponding response value. The responses from Azure AD are usually very specific and will help guide the customer on what is missing in the authentication request (e.g. "error":"interaction_required","error_description: AADSTS50079. The user is required to use multi-factor authentication……).
  5. If the Fiddler trace contains a “seemingly legitimate” access token, copy the token from the trace and debug it. Please note that a valid token could reveal user information and is a subject for the privacy compliance, therefore before debugging it wait for the token to expire. If needed, before sharing this token with support team to continue working on the problem, make sure that the token does not contain relevant user information.

Debug Azure AD Token

  1. Copy the Azure AD access token.
  2. Open a browser of your choice and go to https://jwt.io/

           (*) Disclaimer: this is only a recommendation and opening this link is not required nor owned by
               Microsoft.

  1. Paste the token in the following box:
  2. This will display ObjectID and groups information.
    1. Use ObjectID if a user is individually added to the server, or
    2. Use Guids in groups if a user is logged in as a member of the group.

 

 

Obtain an ObjectID of the user or group trying to login.

   This information can be obtained from the Azure AD portal for a user or group

   (see a screenshot below, indicating in red an Azure AD ObjectID: 25c8820a-xxxx-xxxx-xxxx-fe2fd914e144
  
for user1@sqlxxx.onmicrosoft.com)

 

Capture10.PNG

 

Obtain a SID from Azure SQL DB

Login to a database and execute a SELECT statement from sys.database_principals to find the right SID for a given

Azure AD user or a group.

 

Using the example above for Azure AD user1@sqlxxx.onmicrosoft.com, the following SID is derived from the below SELECT statement

select name, type, type_desc, SID from sys.database_principals where name='user1@sqlxxx.onmicrosoft.com'

 

Output

name                                                             type       type_desc                                                              SID

user1@sqlxxx.onmicrosoft.com               E              EXTERNAL_USER     0x0XXXXXXXXXFE2FD914E144

 

Compare the ObjectID and SID
The last six digits for these two should match. If not, there’s is a mismatch between a user registered in Azure AD and an Azure AD user created in SQL DB. This mismatch has to be resolved.

Based on the example above for user1@sqlxxx.onmicrosoft.com, the last 6 digits for the ObjectID in Azure AD, and the last six digits for the SID  match and represent the same user (see the 6 digits 14E144 indicated in blue).

 

Obtain SQL connection id

https://azure.microsoft.com/en-us/blog/sql-azure-and-session-tracing-id/

 

 

Grant Azure AD permission rights to guest users

 

Review the Azure portal snapshot for User setting - External collaboration setting (see below).
The current setting below prevents guest users to execute certain directory tasks.
To remove this limitation the current setting (in the red circle) must be changed to NO.

 

 

clipboard_image_1.png

 

 

Not able to add Azure AD admin from portal - invalid server name

 

The following PowerShell script using ARM interface can be used to mitigate this problem.

Please note that this script can also be used to set up an Azure AD admin for SQL DB in normal conditions

(the required impute parameters in this script are indicated in blue).

In addition, this script can be used to set up an Azure AD admin for SQL DB in case an admin is a Service Principal.

Currently, the Azure portal search blade displays the Service Principals for the admin setup.

 

 

Import-Module Azure

$tenantId = 'xxxxxe29-xxxxc-4b64-90ac-287b977xxxxx'; # the tenant ID for the Azure AD directory

$administratorType="ActiveDirectory";

$login="user1@aad.onmicrosoft.com"; # the new Azure AD admin for SQL DB (user or group)

$sid="6ac4xxxx-d34c-4XX1-bb03-xxxxfb73xxxx";# the ObjectID of the new Azure AD admin

$clientId = "1950xxxx-xxxx-4e31-a9cf-xxxx9594xxxx" # Microsoft fixed client ID; do not change

$subscriptionId = 'xx77xxxx-a286-xxxx-b6f0-29c42acxxxx' #the server subscription ID

$uri = "urn:ietf:wg:oauth:2.0:oob"

$authUrl = "https://login.windows.net/$tenantId"

$serverName = "SQLxx" # the server name only w/o suffix database.windows.net

$resourceGroupName="sqlxxxx" # the resource name

 

Login-AzureRmAccount -tenantId $tenantId

$AuthContext = [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext]$authUrl

$result = $AuthContext.AcquireToken("https://management.core.windows.net/",

$clientId,

[Uri]$uri,

[Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior]::Auto)

$authHeader = @{

'Content-Type'='application\json; '

'Authorization'=$result.CreateAuthorizationHeader()

}

$body = @{

     properties = @{

           administratorType = $administratorType

           login = $login

           sid = $sid

           tenantId = $tenantId

 }

} | ConvertTo-Json

# Execute the following commands

 

# Display an old AAD admin (called B2B in the example below)

Invoke-RestMethod -Uri "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/provide..." -Method GET -Headers $authHeader;

[output]

properties                                                                                                                               id----------@{administratorType=ActiveDirectory; login=B2B; sid=27xxxxxxx-c2xx-48xx-ac14-ff887xxxxxxx; tenantId=xxxxxe29-xxxxc-4b64-90ac-287b977xxxxx} /subscriptions/xx77xxxx-a286-xxxx-b6f0-29c42acxxx...

 

# Change AAD admin     ( in this example from B2B to user1@aad.onmicrosoft.com )

Invoke-RestMethod -Uri "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/provide..." -Method PUT -Headers $authHeader -Body $body -ContentType "application/json";

[output]

operation                          startTime
---------                          ---------
UpdateActiveDirectoryAdministrator 2019-11-22T19:37:38.777Z

 

start-sleep -s 5; 

# Display a new AAD admin

#( in the example below a new Azure Ad admin   user1@aad.onmicrosoft.com

Invoke-RestMethod -Uri "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/provide..." -Method GET -Headers $authHeader;

[output]

properties                                                                                                                                id--------
@{administratorType=ActiveDirectory; login=user1@aad.onmicrosoft.com; sid=6ac4xxxx-d34c-4XX1-bb03-xxxxfb73xxxx; tenantId=xxxxxe29-xxxxc-4b64-90ac-287b977xxxx /subscri...

 

 

Add an Azure SQL DB application manually into Azure AD tenant

 

/This execution requires an Azure AD admin permission on the tenant/

 

Step 1.
Check if the Azure SQL Database has already been added to the Azure AD directory (see below)

 

clipboard_image_2.png

Azure SQL Database API permissions must also be part of created applications

Below, we indicate the API permissions required for a user created application permission

Go to App registration->myapp-> API my organization uses, and check if “Azure SQL Database” is listed for your tenant) allowing you to grant it the necessary permission (see below).

 

Capture.11.PNG

 

Step 2.

In Case Azure SQL DB is not part of the tenant, the following two options can be used to add it

 

Option 1: Execute one of the commands below comment to create an “Azure SQL Database” application in the tenant

 

  • Connect-AzureAD -TenantId "[The tenant Id]"
  • New-AzureADServicePrincipal -AppId “022907d3-0f1b-48f7-badc-xxxxx”  -DisplayName “Azure SQL Database”
  • New-AzureADServicePrincipal -AppId “022907d3-0f1b-48f7-badc-xxxxx
    New-AzureADServicePrincipal  -DisplayName “Azure SQL Database”

Option 2: Re-register for Microsoft.SQL

  • Register a subscription for Microsoft.SQL by executing the command indicated below and retry.
    • Register-AzResourceProvider -ProviderNamespaceSQL

 

 

Examples of Conditional Access (CA) application policies preventing or blocking access to create Azure AD users from external provider

 

Defining MFA CA policy applying to all cloud apps

clipboard_image_4.png

 

Even though Azure SQL Database is excluded from application requiring MFA (see below), an external Azure AD user cannot be created because the Azure AD graph API requires MFA (see also next snapshot).

clipboard_image_5.png

 

Enforcing CA (see below) is causing an error: “Principal xxx could not be resolved. Error message: AADSTS50079

 

clipboard_image_6.png

In the snapshot below, the CA policy blocks the connection outright, causing an error

“Principal xxx could not be resolved. Error message: AADSTS53003: Blocked by conditional access”

 

clipboard_image_7.png