CompositionalIT / farmer

Repeatable Azure deployments with ARM templates - made easy!
https://compositionalit.github.io/farmer
MIT License
514 stars 156 forks source link

SQL Server Builder - Create System Assigned Identity #1094

Open kevinferretti opened 5 months ago

kevinferretti commented 5 months ago

Thanks for all your work on this awesome project.

I would like to create a system assigned managed identity for my SQL Server as part of the sqlServer builder but that doesn't seem to be possible. I'm willing to put in a PR for this if this is something that you would like to support.

martinbryant commented 4 months ago

Hi @kevinferretti

Would you mean something similar to the grant_access on the storageaccount builder where you can provide a PrincipalId and a RoleId? If so it seems like this would be a good thing to do.

kevinferretti commented 4 months ago

@martinbryant I was thinking something similar to the system_identity flag on the functions builder.

ninjarobot commented 4 months ago

@kevinferretti the resource supports it so this should be doable, and we'd appreciate the contribution!

You'll need to add an Identity field to the IArmResource, similar to how Sites does it for function apps.

Then it needs to be implemented in the JsonModel so it will be emitted in the template. You can also look to the implementation in function apps.

So it can be set from the builder, you'll need to add a field on the builder's config object (example from web apps).

And finally the add_identity operation and the system_identity operation. These will be a little simpler for SQL Server since you don't need to wrap them like it needed for the web apps.

Please give it a try, and reach out if you need help.