-
Notifications
You must be signed in to change notification settings - Fork 301
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
Error: ODataId was nil when creating an azuread_group resource #588
Comments
Hi @bher2000, thanks for raising this! Could you post a debug trace that shows the API requests and responses during the failed apply? The access token will be auto redacted but you may wish to redact the tenant ID too. This will really help in diagnosing the source of the error. For context, when assigning group owners (or owners for other resources), we look up the principal using the directoryObjects API in order to get the OData ID (which is different to the object ID) - this is the key that's needed to assign ownership at create time. The error shown is thrown if the response for that request doesn't contain such an ID. |
Good morning @manicminer, I've tried using a service principal with a client ID and secret (this is what I used for this run to get the TRACE logs) to authenticate and also just running
|
@bher2000 That's great, thanks. That unfortunately confirms that the API is missing the I would recommend raising this as an Azure support issue. I've raised this upstream at microsoftgraph/msgraph-metadata#94 - if you have any additional information it would be great if you could post it there. Since this is an API issue, I'm marking this as blocked for now. Unfortunately there is no workaround right now; due to recent API changes we are forced to always specify an owner when creating a group, even when none are specified in a configuration, and as mentioned we rely on this field for that. |
@manicminer, Thanks again for the quick response! |
I'm facing the same issue I got the following error:
Here is the provider versions
|
@helayoty Thanks for the report, are you also running in Azure Government? L4? |
No, Azure. |
@helayoty Interesting, could you isolate this with a test configuration and post a debug trace? It seems the API response is not what we're expecting but it would be good to see what's actually being returned. Thanks! |
@manicminer I too am facing this same issue; here is my info. I am using Azure, not Azure Government. Error:
Version info:
Debug output:
I have opened a support case directly with Azure. |
As of today, I'm also experiencing a similar error with AzureCloud (not government), but it's even with I suspect this is the same issue, it looks like a response that doesn't contain what I can create a separate issue, but I suspect this is the same root cause. Error:
Providers:
Debug output:
|
is there a workaround for this? I didn't have this problem yesterday, I only experienced it today |
Unfortunately there is no workaround at present. We are raising this API regression with the relevant service team. |
Hey! Looking at the debug output, I've noticed the following header in Graph API responses:
I then tried the following curl request, using the URL that is used by the TF provider in my case:
Notice the
Perhaps the Microsoft has recently changed the definition of what is With TypeScript library, including the import * as graph from "@microsoft/microsoft-graph-client";
const client: graph.Client = ...;
const directoryObject = await client
.api("<tenant ID>/directoryObjects/<app ID>")
.header("Accept", "application/json;odata.metadata=full;charset=utf-8")
.get(); @manicminer Perhaps a similar approach could be used with Go library for Microsoft Graph? Looking at the ticket Perhaps meanwhile implement the full metadata fetching by the client, since this is quite a big blocker (can't really use the provider at all when operating in tenant affected by MS change)? I also think that explicitly specifying full metadata is more futureproof solution in general. Edit: I notice that there may be no official MSGraph client for Go (?). Looks like "Hamilton" library is used to query MSGraph. I think it boils down to allowing customization for this line: https://github.com/manicminer/hamilton/blob/80ee8faed5254353670568f803f5828e5467a6f4/msgraph/client.go#L143 |
I did some research and in the odata standard there are some standard request parameters that can be used, including |
@stazz @mlcooper Many thanks for digging into this. (cc @bher2000, @helayoty, @DmytryEmery, @Bj3MaS) I'm working on an implementation to support OData-related HTTP headers and have pushed a test build to manicminer/terraform-provider-azuread. This is another class of issue that is not affecting any of our testing tenants, so if anyone affected by this issue is able to test and give feedback it would be highly appreciated! You can give this a spin by modifying your terraform {
required_providers {
azuread = {
source = "manicminer/azuread"
version = "12.0.1"
}
}
} This is not a reviewed release and is cut from a development branch. Please do not use this in a production tenant. I'll be deleting the release artifacts in time so it will only work until then. Thanks! |
Hi @manicminer thank you for working on this and pushing a build to test. I am ready to test it out, however it does not appear the https://registry.terraform.io/providers/manicminer/azuread/latest |
Thanks and sorry I was a bit hasty, forgetting that Registry publishing sometimes takes awhile to fully sync! Edit: Looks like it's there now :) |
@manicminer I've just tested your solution, and unfortunately it doesn't work.
Now with a custom version
|
Thanks @mickeder, I'll take a look and try to resolve that |
@mickeder Would you be able to post a debug trace? It would be great it you could limit it to a small configuration containing only the resource that's failing. If you could try and create a test application so that you don't have to redact the UUIDs that would be even better. Thanks! |
Will probably be available in Version = "2.6.0" |
@everyone screaming for a timeframe: Do you require the features in >= 2.0.0 of the provider? If not, just reference 1.6.0 and be happy until the fix is out. |
You can't downgrade once you upgraded and store it terraform state. Terraform doesn't like downgrade to lower version. |
@callppatel @anarsen Good points both of you. I do think, tho, that demanding timeframes for fixes in OSS software that people are using without paying anything at all, is a bit over-the-top. |
Dead right. |
@anarsen Are you suggesting that using the : should solve the problem, if I am using the resource for the first time? |
"that demanding timeframes for fixes in OSS software, is a bit over-the-top" That's my 2 cents. |
Just reporting that this is now occurring on SP creation as well (using pulumi). |
This functionality has been released in v2.6.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
As per the above notice, please upgrade to version 2.6.0 of the AzureAD provider which implements a fix for this issue. At first this issue seemed to affect a small number of tenants but the radius grew over the last few days to affect a large number of tenants. Thank you to all who commented, debugged and otherwise contributed to identifying and resolving this issue, and for all the discussion points - your involvement is greatly appreciated! For anyone who effectively downgraded their provider to a v1.x release to sidestep this API issue, a gentle reminder to remember the upgrade guide when you update your configurations to work with v2.6.0. Edit: If Terraform is not yet picking up the new version for you, please allow several minutes as the TF Registry updates |
I am still having the exact same issue I was having yesterday, and I am using the latest version. I guess I still need to wait as you mentioned? |
@binte Please open a new issue with more details if you are experiencing similar or new issues, thanks! |
Confirmed fixed. Big thanks to @manicminer |
Hi all guys. could some body help me to know why I'm receiving this error on my TF module. │ ApplicationsClient.BaseClient.Post(): unexpected status 403 with OData I am using an Access Key and Secret on my config using a Service Principal. and I have configured Microsoft Graph > User.ReadWrite.All Thank you in advance |
@Maximo1990 - You will need to have one of the following roles: application roles: Application.ReadWrite.All or Directory.ReadWrite.All More info listed here: https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application Cheers! |
@brnwn4 thanks for your help, let me try whit this roles. |
@Maximo1990 - No problem. Should work out, i initially hit the same error on my initial deploy with a SP. |
Thanks for the quick action on resolving this folks, much appreciated! |
@brnwn4 the issue still continue. |
Thanks for resolving this so quickly! I am back up and running. |
@Maximo1990 Thanks for reaching out. As this is our issue tracker, used mainly for bug reports and feature requests, I would suggest following our Authentication Guide to get set up to use the provider. After this, if you are still experiencing problems I recommend our Discuss forum or our Slack group (details in the project readme) where the community or maintainers will be happy to assist with your configuration. Thanks! |
Community Note
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_group
Terraform Configuration Files
Debug Output
Expected Behavior
The group should have been successfully created
Actual Behavior
An error occurred mentioning ODataId was nil
Steps to Reproduce
Important Factoids
We are attempting to create groups in our Azure Active Directory hosted in Azure US Government.
The text was updated successfully, but these errors were encountered: