Hey there! I'm looking for advice on how to test ARM template expressions without having to deploy every time. I'd love to find a way to run functions on inputs like strings or arrays, with fake data, just to see the returned value in real-time. I'm pretty new to developing templates and policies, and it gets tricky pushing updates to the API only to find out something's broken. Any tips on local testing would be greatly appreciated!
1 Answer
For ARM templates, you actually need a subscription to test them. A handy command is `Test-AzResourceGroupDeployment`. This will validate everything without deploying it, but keep in mind you must be signed in and have a valid subscription/resource group. Plus, you can add a `-verbose` switch for more detailed output.
Thanks for the tip! I’ll try using that. Just to clarify, if I have an expression like this: `concat('/', join(take(split(field('Microsoft.Network/privateEndpoints/subnet.id'), '/'), 8), '/'))`, I want to plug in a fake subnet ID and see the output directly. Does `Test-AzResourceGroupDeployment` do that?
Is there a similar method for testing Bicep templates?