-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_azuread_service_principal does not always find a Service Principal #1844
Comments
I think I've found the issue. Any chance you have +100 Service Principals in your Azure AD tenant? Even if that is not the case in your environment, I'm going to create a PR to fix this. This also affects the other azuread* resources. |
@tiwood I just tried this. I do not have 100+ SPNs in my Azure AD tenant and still experiencing the same error described in the issue. |
@gvilarino, are you sure? I've just checked on my side and I have way over 150 Service Principals, were many of them are sort of 'builtin'. You can check that with pwsh: |
Ok @tiwood, after more carful inspection it seems I may have more. I don't use Windows so I can't use PowerShell (non-win version is severly bugged/limited) so I tried this in Azure CLI 2.0:
This returns way over 100. (Is this the correct command?) However, I do have under 100 Azure AD apps. Again, the extremely frustrating naming they used (in the portal, SPNs are named Enterprise Applications and apps App Registrations) |
Yes, this is the correct command. If you are over 100 then you will have issues with the current iteration of the azuread resources. Service Principal (Enterprise Registration)
Application (Enterprise Application)
This is a pretty good and short writeup. |
Thanks for clarifying @tiwood. I hope the fix lands soon :) Also, do you happen to know a good place to understand where/how to grant permissions described by @steve-hawkins here? I tried it before but wasn't successful |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Terraform Version
Terraform v0.11.8
Affected Resource(s)
Data Source: azurerm_azuread_service_principal
Terraform Configuration Files
Debug Output
gist
Panic Output
N/A
Expected Behavior
The Application Registration Service Principal Object ID should be returned
Actual Behavior
A Service Principal for Application ID was not found
Steps to Reproduce
This part is hard to document as I have only noticed it on three out of five current Application Registrations. I will add more here if I can find an issue with the actual Application Registrations, but as I mention in the section below using the Azure CLI I can find the Service Principal Object ID for all the five Application Registrations I have created.
terraform apply
Important Factoids
az ad sp show --id '[REDACTED]'
References
N/A
The text was updated successfully, but these errors were encountered: