azurerm_mssql_job_step – support managed-identity authentication by making job_credential_id optional#30031
Conversation
…-identity fallback
|
Hi @WodansSon, would you be able to take a look when you get a chance? We'd appreciate your help in moving this PR forward. |
|
Hi @katbyte, I've fixed the errors. Could you please re-run the tests? |
sreallymatt
left a comment
There was a problem hiding this comment.
Thanks for opening this PR @rorsgo, I've left a few comments inline, additionally could you also run make terrafmt to format the test configurations? (This should resolve the failing GHA)
|
Hi @sreallymatt — thanks for the quick turnaround on the feedback! Let me know if you spot anything else or would like additional tweaks. Appreciate the review! 🥇 |
7d06d9b to
1558992
Compare
|
Still having issues with the docs. I’ll correct the typo and push an update shortly. |
|
Hi @rorsgo, to provide an update to this PR. We've unfortunately got 2 test failures ( This likely means we'll need to send an explicit |
|
Hi @sreallymatt, thanks for the update and for looking into this! Please let me know what you find, and if there's anything I can do to help :) |
|
Hi @sreallymatt and @rorsgo, I have been following this PR closely because I too need this functionality. Until this PR is merged, I did work around the resource "azurerm_mssql_job_credential" "my_unused_job_credential" {
...
password = random_password.temp.result
}
resource "azurerm_mssql_job_step" "my_job_step" {
lifecycle {
ignore_changes = [job_credential_id]
}
...
job_credential_id = azurerm_mssql_job_credential.my_unused_job_credential.id
}I did see that once you set a job step's credential via the Azure Portal, you cannot unset it. Upon further investigation, I also found that Microsoft's How did I clear the job step's credential in my workaround above? I edited the Given this, I would suggest that the markdown description for the |
|
Looking into this, it seems that once a job credential is set, it's not meant to be removed. However, in case that behaviour should be supported I have opened an issue on the Azure REST API spec repository. (Azure/azure-rest-api-specs#35881) To make this clear to users, and to avoid a constant diff, we'll have to use a @rorsgo, did you want to take a look at adding a |
|
@sreallymatt thanks! That would be great — I'm currently away from my computer, so feel free to push the changes to my branch. Appreciate the help! |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |

Community Note
Description
Resolves #29076 – Support managed identity instead of job_credential_id
Elastic Job Steps can now run under the Job Agent’s User/System-Assigned Managed Identity by simply omitting job_credential_id from azurerm_mssql_job_step.
This change makes hybrid and key-vault scenarios easier because secrets no longer need to be stored in SQL credentials.
PR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_mssql_job_step– feature:job_credential_idis now optional; when omitted the Job Step authenticates with the Job Agent’s managed identity [Support for user assigned managed identities in azurerm_mssql_job_step #29076]This is a (please select all that apply):
Related Issue(s)
Fixes #29076
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Note
If this PR changes meaningfully during the course of review please update the title and description as required.