Template Specs Not Working as It Shows Error 'Template'

%3CLINGO-SUB%20id%3D%22lingo-sub-2297984%22%20slang%3D%22en-US%22%3ETemplate%20Specs%20Not%20Working%20as%20It%20Shows%20Error%20'Template'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2297984%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Community%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20not%20been%20able%20to%20use%20Azure%20Template%20Specs%20for%202%20days%20already%2C%20whenever%20I%20tried%20to%20deploy%20the%20template%20specs%20it%20gives%20me%20the%20following%20error%3A%3CBR%20%2F%3E%3CBR%20%2F%3EERROR%3A%20'template'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20believe%20it%20is%20an%20issue%20from%20Azure%2C%20even%20if%20I%20follow%20the%20following%20quick%20start%20guide%2C%20still%20getting%20the%20same%20error%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Fquickstart-create-template-specs%3Ftabs%3Dazure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20and%20deploy%20template%20spec%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Enote%3A%3CBR%20%2F%3EIf%20deploy%20it%20using%20portal%2C%20it%20works.%3C%2FP%3E%3CP%3EIf%20deploy%20the%20template%20file%20without%20using%20template%20specs%2C%20it%20works.%3C%2FP%3E%3CP%3EOnly%20fails%20if%20deploy%20using%20template%20specs%20with%20the%20resource%20id%2C%20for%20example%3A%26nbsp%3B%3CBR%20%2F%3E%3CEM%3Eaz%20deployment%20group%20create%20--resource-group%20storageRG%20--template-spec%20%24id%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20help%20if%20you%20have%20any%20insight%20on%20this%20issue%2C%20thanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJian%3C%2FP%3E%3C%2FLINGO-BODY%3E
Visitor

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

1 Reply

@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