-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSI expiry date format fix for Azure Functions #1308
Conversation
Attaching the latest driver jars with this fix included. |
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## dev #1308 +/- ##
============================================
- Coverage 58.43% 58.27% -0.16%
+ Complexity 3827 3786 -41
============================================
Files 133 133
Lines 30096 30087 -9
Branches 4979 4977 -2
============================================
- Hits 17586 17533 -53
- Misses 10076 10095 +19
- Partials 2434 2459 +25 Continue to review full report at Codecov.
|
Hi @sgarcia2101, thank you for your input. The API version for Azure function / App Service that the driver uses has been updated to |
I dont know why, but if I use "clientid" paramete, it works, and if I use "client_id" parameter, I receive this error: {"statusCode":400,"message":"No UserAssigned Managed Identity found for specified ClientId/ResourceId/PrincipalId.","correlationId":"xxxxxxxx"} |
I think the older versions of the API versions still accept "clientId", but the latest API version accepts "client_id". Could you show me how you're sending your HTTP GET request to the Azure endpoint? (but this would be unrelated to the driver) Also, you could refer to this page for details: https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=dotnet#using-the-rest-protocol |
Yes, sure. I have this code in Java deployed in an App Service with System Assigned Managed Identity enabled. The parameters are the clientId generated by System Assigned MI and the resource is "https://database.windows.net/".
Then the final request is:
|
This is an example of my GET request that works for me:
I think your GET request looks correct, I'm not sure why it's failing for you. Perhaps it's because in your code you showed me, you're still sending |
Sorry, I pasted the code that is working, because I use clientid with X-IDENTITY-HEADER. As you said, the latest api version 2019-08-01 works with client_id and X-IDENTITY-HEADER, but if I test with this, it is not working. |
I see. I'm not sure if I can help you further on this front, because I think your example looks like it should work to me. You can submit a support ticket to Azure regarding this issue, if you want more help on this. |
Fixes issue #1135.
The format in which the expires_on property is sent to the driver from Azure server used to be in the form of a string, but starting from the latest API version (2019-08-01), this value is now an integer value, which is consistent across all regions and operating systems (Windows/Linux).
Note that this fix only applies to retrieving access tokens for MSI authentication from Azure Functions (and Azure Web Apps), and it doesn't affect the usual Azure IMDS routine for MSI authentication.