How Can I Test ARM Template Functions Locally?

0
5
Asked By CuriousCoder77 On

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

Answered By TechGuru99 On

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.

QueryMaster42 -

Is there a similar method for testing Bicep templates?

CuriousCoder77 -

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?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.