Azure Powershell commands for Azure AD management - azure-active-directory

Context
I am co-admin of an Azure subscription.
I created Azure active directory in the same.
I started the Azure Powershell.
Azure account was added successfully.
Problem
But, when I fire the command "Get-AzureADUser", it fails to provide the needed.
Also, when I tried with putting proper input like valid objectID, It did not return any value.
Question
To what Azure AD does the Azure Powershell command "Get-AzureADUser" establishes connection with?

"Get-AzureADUser" command works with AzureResourceManager mode.
It calls the "Default directory" of the Azure subscription.
It can only be authenticated with the credentials of Service Administrator of that
subscription.
It works fine if the above mentioned are followed.

Related

Azure Active Directory Integrated Authentication with SQL

I'm quite new to the Azure AD. So I will be grateful for any hint.
I need to enable members of a given domain (of a given Active Directory) to log in to Azure SQL Server using Azure Active Directory - Integrated Authentication.
So far I've logged into Windows and connected it to Azure Acticve Directory in Windows Setting.
Looking through the documentation, I understand that I need to select one of the authentication methods proposed by Microsoft within Azure Active Directory. The easiest seems to be Password hash synchronization. So I would like to pick this one (But if others are simpliest I am open to change that choice)
What is the easiest way to synchronise this? Can I avoid having to create a Windows Server VM and install Azure AD Connect there?
The current configuration of AD Connect on Azure Portal looks as follows:
To mention it again, the only service I care about is logging in via Azure Active Directory
I apologise if the whole question has been wrongly structured, but it is simply based on what I have found on the forums and in the documentation.
Thanks in advance for any tips
[for example: https://youtu.be/PyeAC85Gm7w?t=565, https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?tabs=azure-powershell#using-an-azure-ad-identity-to-connect-using-ssms-or-ssdt, https://techcommunity.microsoft.com/t5/azure-sql-blog/azure-ad-pass-through-and-password-hash-authentication-support/ba-p/1269735]
You don't need Azure AD Connect or password hash sync unless you have an on-premise Windows Server AD that you want to sync to Azure AD. Should note that AD is not the same as Azure AD. You don't need Windows Server AD with Azure SQL, just Azure AD. To grant a certain security group access to the server, you can run CREATE USER [group-name-here] FROM EXTERNAL PROVIDER; in the Azure SQL DB. Then you can use standard SQL stuff to grant that "user" access to the DB/tables.
Users should then use Azure Active Directory - Universal with MFA as the authentication method in SQL Server Management Studio.

Connect to Azure SQL database using SSMS via AAD MFA when account is guest of another directory

I have a problem when connecting to an Azure SQL Database using SSMS under this scenario:
Have a work laptop connected to work domain via VPN
The database is in a different Azure tenant (tenant B) to my work Azure tenant
(tenant A).
My work account is set up via AAD in the work Azure tenant (A)
and is a guest account in other tenant (B)
Have the latest version of SSMS
Granted user access to the Azure SQL database
I connect via SSMS using the Azure Active Directory - Universal
with MFA option
Note all default options are set and have also tried setting the database
I know the database access has been correctly set up as I have successfully been able to connect in the above scenario when I use Azure Data Studio instead of SSMS, but only because I have the option to change "Azure AD tenant" property from "Tenant A" to "Default Directory".
I have been able to connect OK when using SSMS with my personal computer using the same account / method, except it is not using a work account and is not connected to the work domain.
Seems like my issue is that I cannot change the "Azure AD tenant" property in SSMS and it is using the tenant associated with my account. I have also tested with a number of different people and they have the same issue. I have also set the default Azure directory to tenant B in the Azure portal.
Does anyone have any suggestion how I can get this to work in SSMS?
Azure Data Studio connection
Thanks Tony
OK, I am answering my own question.
I have a work-around which involves:
Create a connection in Azure Data Studio and setting the Azure AD Tenant to "default directory"
In SSMS, connect to the Database using the Azure Data Studio connection in the Registered Servers pane
Not ideal, but it works.

"a specified logon session does not exist. it may already have been terminated" after i joined the device to azure active directory

"a specified logon session does not exist. it may already have been terminated" after i joined the device to azure active directory
-i can't access our shared folder in our server after i joined the device to azure AD and use office 365 account (Please see click the link below to see the error image for your reference), but if i use local administrator of the device i can access the file server using the credentials with no problem, please note that we don't have an premises active directory or GPO, kindly help me.
a specified logon session does not exist. it may already have been terminated
Instead of specifying just "binos" as your username, add hostname with back-slash like so:
yourhostname\binos
In most cases, this will fix that error.
To access the share, the server would also need to be azure ad joined. which you cannot do with windows server, you would need azure ad Domain Services (AD DS) on azure, then join your file server to that.
Only Windows 10 devices can be "azure ad-joined devices"
If you don't want to do that, you could create a azure file store, and secure it using your azure ad / rbac, then map that on your devices.. that would probably work too.

Connect to Azure database with DataGrip - Active Directory

I am trying to connect to Azure database via DataGrip using Active Directory connection (Note: not Active directory - password)
I followed accepted answer from this
I set integratedSecurity=false and authentication=ActiveDirectoryIntegrated.
When trying to connect to Test Connection I get error message
Connection to Azure SQL Database failed. Cannot set "Authetication" with "IntegratedSecurity" set to "true".
Is it some kind of bug that can be repaired, if so how could I solve this issue?
Edit:
More information:
On Azure Portal I can see that this is SQL database.
Server name ends with database.windows.net.
When I try to connect via Connection String (in Data Grip Add data from URL) generated by Azure I am not able to connect also.
The DataGrip support us using Azure Active Directory Authentication. Please see: Microsoft Azure .
You can get the connect string (URL) with Active Directory integrated authentication from Portal:
Replace the URL with the Connect string(Active Directory integrated authentication):
Hope this helps.
There is a lot of confusion around terminology here.
In short, the connection string attribute Integrated Security=true indicates you want to use "windows authentication". This type of authentication might be supported by any Azure SQL (anything whose hostname ends in database.windows.net). Azure SQL only supports Azure Active Directory authentication, butit might be possible to implement single sign on between a windows domain account and Azure Active Directory.

Azure AD Auth on LocalDB

I presume that LocalDB does not support Azure AD auth, as I receive the following error message:
CREATE USER [myuser] FROM EXTERNAL PROVIDER;
Incorrect syntax near 'PROVIDER'.
(I'm attempting to create a Local DB for integration testing from the same DacPac).
However I cannot find any documentation that suggests explicitly that LocalDB (nor SQL Express) does not support Azure AD Auth.
Experience has found that just because it's not documented doesn't mean it's not possible.
In Azure SQL Server, you activate AD auth by assigning an Azure AD user to be an administrator, which can be done via AzureRM powershell module. Is there an equivalent none azurerm way of achieving the same thing?
Currently it is both not documented and not possible to do AAD auth on LocalDB.

Resources