Deploy latest version of templatespec using 'Microsoft.Resources/deployments' #17425
D-Bissell
started this conversation in
Authoring Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a situation where I am trying to create a generic template to deploy a Template Spec. I want to be able to deploy either the latest version of the template spec or a given specific verison.
Unfortunately I can't use the
module templateSpec ts:/way because the resource group in the path will change depending on the environment it is deployed to. Bicep does not allow variables in the module path.Deploying a specific version is easy enough - just get an
existingreference to that version of the template spec, then use its resource ID intemplateLink.idfor the deployment.However, I am struggling to get this working with 'latest'. Deploying the 'parent' template resource spec does not work - I get an error:
InvalidTemplateSpec: The template link ID '/.../Microsoft.Resources/templateSpecs/templateSpecName is not a valid templatespec version.
I also can't use 'latest' as the version to deploy for a specific version. I get an error 'Unable to retrieve the template content from the resource ID '/.../Microsoft.Resources/templateSpecs/templateSpecName/versions/latest'
I have been trying to get the versions information out of the parent template spec resource, but it does not appear to populate this fully.
Adding the above to the bicep template results in an error on deployment that the language expression property 'versions' does not exist. The only available property is 'description'
The linter shows that this should work. However the api reference says that the templatespec.versions property:
Gets high-level information about the versions within this Template Spec. The keys are the version names. Only populated if the $expand query parameter is set to 'versions'.https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.resourcemanager.models.templatespec.versions?view=azure-dotnet-legacy#microsoft-azure-management-resourcemanager-models-templatespec-versions
I have not found a way to add the $expand query to the
existingcall to get the template spec.Is there another way I can go about this?
Beta Was this translation helpful? Give feedback.
All reactions