Forum Discussion

jianhuangbodun's avatar
jianhuangbodun
Copper Contributor
Apr 27, 2021

Template Specs Not Working as It Shows Error 'Template'

Hi Community,

 

I have not been able to use Azure Template Specs for 2 days already, whenever I tried to deploy the template specs it gives me the following error:

ERROR: 'template'

 

I believe it is an issue from Azure, even if I follow the following quick start guide, still getting the same error:
Create and deploy template spec - Azure Resource Manager | Microsoft Docs

note:
If deploy it using portal, it works.

If deploy the template file without using template specs, it works.

Only fails if deploy using template specs with the resource id, for example: 
az deployment group create --resource-group storageRG --template-spec $id

 

Please help if you have any insight on this issue, thanks.

 

Jian

  • jianhuangbodun 

    The following examples might help you. See below.

    # Author : Pinaki Ghatak Microsoft
    # Purpose : This is Github workflow  to deploy Azure Template specs from ARM templates
    
    # Disclaimer : This is for demonstration and workshop purpose only. Please understand the logic, and verify and 
    #              test before implementing this in your environment.
    
    # Last update : 01-June-2021
    
    name: 'PG-TemplateSpecs-CI-CD'
    on:
      # Triggers the workflow on push or pull request events but only for the main branch
      push:
        branches: [ main ]
      pull_request:
        branches: [ main ]
    
      # Allows you to run this workflow manually from the Actions tab
      workflow_dispatch:
    env:
      # Common variables
      WORKINGDIRECTORY: ${{ github.workspace }}/
      
      # Dev environment variables
      AZURE_SUBSCRIPTION_ID: YourSubscription_d
      AZURE_RESOURCE_GROUP: 'Your-TemplateSpecs-RG' # Resource group for the Templatespecs
    
      
      #templatespecs  info
      TEMPLATESPEC_NAME : CS-AzureFunctions
      TEMPLATESPEC_VER : 0.1
      TEMPLATESPEC_DESC : 'Template for Azure Functions'
      TEMPLATE_SPEC_LOCATION: WestEurope
      
    jobs:
      VerifyAndDeploy:
        name: Verify And Deploy
        runs-on: windows-latest
        steps:
          - name: Checkout source code
            uses: actions/checkout@v2
    
          # Login to Azure
          - name: Azure Login
            uses: azure/login@v1
            with:
              creds: ${{ secrets.AZURE_CREDENTIALS }}
              enable-AzPSSession: true
    
          - name: Deploy Template Spec
            uses: azure/powershell@v1
            with:
              azPSVersion: 'latest'
              inlinescript: |
                az ts create -g ${{ env.AZURE_RESOURCE_GROUP }} -n  ${{env.TEMPLATESPEC_NAME}} --description '${{env.TEMPLATESPEC_DESC}}' -v ${{env.AZFUNCTION_TEMPLATESPEC_VER}} -f ./ARMTemplates/main.json -y

Resources