Access IMDS server or Active Directory MSI method to onprem machine which is joined Azure AD

Copper Contributor

We want to use AzureSqlServer with ActiveDirectoryMSI authentication as well as token-based authentication and We are able to execute successfully from VM created in Azure network and added as a member of the Azure AD group. For that, we have created Contained user by following the link

https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-...

And added the VM as part of AzureActiveDirectory by following this link

com.microsoft.sqlserver.jdbc.SQLServerException: MSI Token failure: Failed to acquire token from MSI...

And we are able to access the SQL data without providing username and password using both IMDS server and able to retrieve the token using http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2F...

and

ActiveDirectorMSI URIString jdbc:sqlserver://azuresqlserverNAME:1433;databaseName=DatabaseNAME;Authentication=ActiveDirectoryMsi; .

But when it comes to access from Onprem Windows/Linux/Mac (joined as device and made part of Azure AD group where group is set as Admin for Azure Sql server) machine we are not able to access Azure SQL server
Even not able to access IMDS server , when i tried executing java code which does active directory msi even faild saying invoke-WebRequest : unable to connect remote from Powershell and com.microsoft.sqlserver.jdbc.SQLServerException:Failed to aquire access token from IMDS,Unexpected error occured from java code using authentication as ActiveDirectoryMSI in jdbc uri.

Can someone please suggest to me in terms of on-prem what needs to be done so we can access AzureSqlServer with ActiveDirectoryMSI Authentication as well as token-based authentication?

0 Replies