Failed to connect to PostgreSQL with Azure AD User via Azure data studio - azure

I am following this post and I have added Azure AD User to my Azure PostgreSQL. When I use admin user I can connect to the server but when I change to use Azure AD-based authentication, it always got error Token get failed .... I think I'm lost, please help me. Thanks in advance.

Not sure about the reason because you didn't provide details about how you configure the AAD-based authentication.
But there is a new, simpler way to sign-in with AAD account.
Please refer to New, simpler way to sign-in to Azure Database for PostgreSQL - Single Server using Azure AD.
You just need to configure the Azure AD Administrator in the Azure Portal.
Remember that when you try to sign in in Azure Data Studio, you need to specify the username as AADuser#{your AAD domain}.com#{PostgreSQL server name}

Related

Authenticate to Kusto using managed identities in Python

I'm trying to improve authentication to my Kusto clusters from my functions once they're deployed into production environment. Locally, I connect thru AZ CLI authentication, but I've found out that my organization generated a user assigned managed identity for my Kusto cluster.
I have a principalId and a clientId. How do I authenticate using the managed identity?
TIA
See example for use of MI Auth in the below link.
Please mind MIs only work when running in Azure in a host that this MI was attached to.
https://github.com/Azure/azure-kusto-python/blob/80cd8b61b681069e461141c98f4d7e29cdb4a783/azure-kusto-data/tests/sample.py#L61
Maybe you got not a manged identity but a application identity. This is a service account in azure ad.
That way, you can get a oauth2 token and use it to query the service.

Mattermost and Azure AD integration

I am trying to configure Azure AD as a part of single sign in Mattermost. However, I'm not able to find any relevant documentation.
Any leads could help.
I have already gone through the following documentations -
https://docs.mattermost.com/onboard/sso-office.html
https://docs.mattermost.com/onboard/ad-ldap.html
I'm not sure if these documentations are relevant.
Mattermost integrates with Azure AD using Open ID Connect authentication to enable SSO between Azure AD, Mattermost and other Azure AD enabled apps using Azure AD credentials.
Basically, you need to setup or own an Azure AD Tenant (Dismiss the Social and local accounts section), create an app registration and configure OpenID Connect authentication as detailed in the Mattermost documentation.
https://docs.mattermost.com/onboard/ad-ldap.html is intended for on-premise Active Directory using LDAP which is not supported in Azure AD.

NodeJs code to connect Azure SQL database using 'Azure AD-Universal with MFA'

I have been trying to find out some nodejs code in order to connect from my nodeJs application to Azure SQL db via Azure AD authentication. But this will involve only my email Id. I don't have any Azure AD app as this will be from an email ID. I usually login onto my Azure SQL DB using my email Id and choosing the option 'Azure Active Directory-Universal with MFA' from MSSMS. Is there any way that we can replicate this from Code in NodeJs
If you want to Use Azure Active Directory authentication for your Azure SQL database, you must configure Azure AD for it.
Please ref this tutorial: Configure and manage Azure AD authentication with Azure SQL
SSMS and SqlPackage.exe are the only tools currently enabled for MFA through Active Directory Universal Authentication.
For your question "Is there any way that we can replicate this from Code in NodeJs", the answer is no, there isn't. Node.js only support these types:
authentication.type
Type of the authentication method, valid types are default, ntlm,
azure-active-directory-password, azure-active-directory-access-token,
azure-active-directory-msi-vm, or azure-active-directory-msi-app-service
Ref: https://tediousjs.github.io/tedious/api-connection.html
HTH.

Use AD authenication in azure App Services

We have easily sent up our AD with Azure SQL which now we can login and run queries, etc... with SSMS. Now we would like to set our apps in Azure App Services to run as an AD user. This would be to mimic IIS apps using an application pool that's is running as an AD user. I have not found a clear blog or step by step guide on how to do this. any help would be greatly appreciated.
UPDATE:
This is specifically to be able to connect to the database using AD Credentials and not using SQL Credentials.
Azure Active Directory authentication for SQL Database or SQL Data Warehouse supports the following methods of connecting to a database using Azure AD identities( refer here):
Using integrated Windows authentication
Using an Azure AD principal name and a password
Using Application token authentication
And the scenario you mentioned is not support. We can create an application in Azure AD and using the token authentication for this scenario. More detail about Azure AD authentication, you can refer the link below:
Configure and manage Azure Active Directory authentication with SQL Database or SQL Data Warehouse- Azure AD token
In addition, if you have any idea or feedback about Azure SQL database, you can submit them from here.

Azure SQL Authentication connection string in Azure App Service?

Microsoft allows use of the Authentication command in Azure SQL to connect to the database using an Azure AD account.
https://azure.microsoft.com/en-us/documentation/articles/sql-database-aad-authentication/
Under heading 7.1. Connecting using integrated (Windows) authentication
How can I use this on an Azure App Service?
Note: I am specifically trying NOT to include the password as the next heading shows. I specifically want integrated.
If my understanding of the documentation is correct, you can achieve this yourself using Token Based authentication. It shouldn't require anything special from Azure App Service. See here for details and sample code:
https://blogs.msdn.microsoft.com/sqlsecurity/2016/02/09/token-based-authentication-support-for-azure-sql-db-using-azure-ad-auth/
The new token-based authentication method allows middle-tier services to obtain a token from Azure AD and use it to connect to Azure SQL Database.
Azure App Service machines are not part of your domain, so this isn't going to work. This was designed to let domain joined clients connect to SQL.
SQL Username/password is the only option left.
Update: see Chris Post about the new token based features

Resources