-
Notifications
You must be signed in to change notification settings - Fork 300
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
azuread_service_principal_password: Password not set correctly #66
Comments
I've spent a lot of time today fighting with the same issue. The password for the principal is not set. It's just missing in the UI. The CLI returns the error mentioned above. Using the cli to create the principal ( |
The bug was in Azure-CLI and it looks like the fix is in... |
I'm skeptical. The credential was not showing in the UI either as I stated before:
|
Now the $ az ad sp credential list --id <generated_id>
[] I am using the following versions:
|
I think what's happened is the API has changed. Azure Graph AD v1.6 versus Microsoft Graph v1.0. The UI actually returns different keys for the credentials object: Azure Graph AD "passwordCredentials": [
{
"customKeyIdentifier": null,
"endDate": "2024-05-03T00:00:00Z",
"keyId": "a1ac2284-48c6-44aa-9003-62b2f5ac421b",
"startDate": "2019-05-03T09:00:25.9707702Z",
"value": null
}
], Microsoft Graph "passwordCredentials": [
{
"customKeyIdentifier": null,
"endDate": "2020-07-10T04:03:30.998Z",
"keyId": "3bc6171a-a738-448e-b43f-57587abf3e03",
"startDate": "2019-07-10T04:03:34.987Z",
"value": "wpHbb3KUKEJ_mZf09+Tg1?:K*V5ZV-f0",
"createdOn": "2019-07-10T04:03:35.1909766Z",
"hint": "wpH",
"displayName": "Password uploaded on Wed Jul 10 2019"
}
], Terraform calls the old API that returns a clearly created and attacked password credential: "passwordCredentials": [
{
"customKeyIdentifier" :null,
"endDate":"2299-12-30T23:00:00Z",
"keyId":"5b7b5ddb-a7af-ea5c-4f0e-1582a182faa9",
"startDate":"2019-07-10T03:57:06.4922606Z",
"value":null
}
], |
@katbyte Any updates on this issue? Is there anything on the Azure side blocking this functionality? |
@philbal611 I'm pretty sure this is completely Azure blocking at the moment. See this issue: Azure/azure-sdk-for-go#5222 |
Is there a workaround or a planned fix for this? It's a major roadblock for creating service principal |
@cbtham Problem appears to be upstream. The SDK doesn't have a work around last time I checked. I'm creating SPs with the |
how do you do that? Do you have a reference? Let me know if it works for you |
@cbtham I am using a |
I believe this may be related, but we ran into an issue with destroying the sp password. Though this happened in Terraform, I suspect the same underlying issue is at heart. In our case it appears the Application ownership do not extend to the service principal passwords created in this manner. I created the Application and the SP entries and assigned my coworker ownership of the application, but my co-worker was unable to destroy the SP.
Which looks sane according the
|
So at the moment there is still no fix scheduled? |
@cbtham, I believe the issue is blocked by an upstream Azure SDK bug. See https://github.com/Azure/azure-sdk-for-go/issues/5222. I'm sure an upvote on the issue could help or poke your Microsoft rep. |
I was able to work around this using the deprecated azurerm_azuread_service_principal and azurerm_azuread_service_principal_password resources. |
@poddm, which azuread provider version did you use? I tried with v0.4 and v0.6, using deprecated azurerm_azuread_service_principal and azurerm_azuread_service_principal_password, doesn't work, even with additional deprecated azurerm_azuread_application, still no application password was created. |
@myrah, it's the deprecated resources in the azurerm provider.
I'm using the latest azurerm provider |
This works for me:
I then use it to create a kubernetes cluster:
In the portal, I don't see a client secret against the application but the Kubernetes cluster deploys successfully. Interestingly, I had to add depends_on for azuread_service_principal.main despite it being referenced in kubernetes resource. I had the same problem as the person who originally raised the issue but upgrading Azure CLI has resolved it for me. Edit: After further investigation, the reason why the secret isn't showing in the Azure portal is because those are the application secrets and not service principal secrets. I have just tried this:
and then this, in the kubernetes cluster definition:
and it works fine. The secret is also showing in the portal. In fact, this is probably the better way to do it as it allows for importing of clusters created via the portal into TF. Using: |
you can NOT see service principal passwords in the portal AFAIK, only application secrets/passwords. they are slightly different in a single tenant app scenario and WAAAAY different in the multi tenant scenario |
I believe this is a portal usability issue. You can no longer view secrets for service principals in the portal, only secrets for applications.
As @drdamour mentioned, SP passwords and app passwords are somewhat different yet can be used interchangably in some scenarios. Closing as this is not really related to the provider, however please feel free to comment if there's a subtlety I have overlooked! |
@manicminer would you elaborate on that please? I am able to see secrets for principals (app registrations). What I'm never able to see after principal creation-via-cli is the principal password (which acts as a secret but it's never shown after that, and you can never see it from the portal). Thanks |
Hey @gvilarino, it can get confusing with the interchangeable language used in the CLI and elsewhere, but app registrations and service principals (aka enterprise applications) are two different objects in Azure AD. The portal exposes a UI for listing secrets (passwords) for app registrations, but not for service principal secrets. It used to be the case that secrets were stored with the SP, but they are now [typically] stored with the app registrations, and in many auth scenarios you can use a secret from either entity when authenticating with the clientID of the app registration. In the provider, we have resources for setting either of the two secret types. If you use the |
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
Community Note
Terraform (and AzureAD Provider) Version
Terraform v0.11.13
Affected Resource(s)
azuread_service_principal_password
Terraform Configuration Files
Debug Output
Expected Behavior
The service principal is created, and the password for it is set.
Actual Behavior
This bug is the same as the one explained in the issue linked below, but because it was locked I created a new issue here.
Using
az
CLI, I discovered the following error:Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: