Azure ARM Template using devops

%3CLINGO-SUB%20id%3D%22lingo-sub-3277143%22%20slang%3D%22en-US%22%3EAzure%20ARM%20Template%20using%20devops%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3277143%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20deploy%20the%20arm%20template%20using%20the%20azure%20devops%20and%20getting%20the%20below%20errors.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E2022-04-05T23%3A26%3A12.1776465Z%20%23%23%20Validating%20Inputs%0A2022-04-05T23%3A26%3A12.1904516Z%20%23%23%20Validating%20Inputs%20Complete%0A2022-04-05T23%3A26%3A12.1921198Z%20%23%23%20Initializing%20Azure%0A2022-04-05T23%3A26%3A12.6336103Z%20Added%20TLS%201.2%20in%20session.%0A2022-04-05T23%3A26%3A13.9432297Z%20%23%23%5Bcommand%5DImport-Module%20-Name%20C%3A%5CModules%5Cazurerm_6.13.1%5CAzureRM%5C6.13.1%5CAzureRM.psd1%20-Global%0A2022-04-05T23%3A26%3A32.7370919Z%20%23%23%5Bcommand%5DClear-AzureRmContext%20-Scope%20Process%0A2022-04-05T23%3A26%3A34.0422406Z%20%23%23%5Bcommand%5DDisable-AzureRmContextAutosave%20-ErrorAction%20Stop%0A2022-04-05T23%3A26%3A36.3893461Z%20%23%23%5Bcommand%5DAdd-AzureRMAccount%20-ServicePrincipal%20-Tenant%20xxx%20-Credential%20System.Management.Automation.PSCredential%20-Environment%20AzureCloud%20%40processScope%0A2022-04-05T23%3A26%3A38.4440610Z%20%23%23%5Bcommand%5D%20Select-AzureRMSubscription%20-SubscriptionId%20xxx%20-TenantId%20xxx%0A2022-04-05T23%3A26%3A38.9096942Z%20%23%23%20Initializing%20Azure%20Complete%0A2022-04-05T23%3A26%3A38.9129374Z%20%23%23%20Beginning%20Script%20Execution%0A2022-04-05T23%3A26%3A39.0519074Z%20%23%23%5Bcommand%5D%26amp%3B%20'D%3A%5Ca%5C1%5Cs%5CDeploy-Aztemplate.ps1'%20-ArtifactStagingDirectory%20'D%3A%5Ca%5C1%5Cs%5Cquickstarts%5Cmicrosoft.sql%5Csql-logical-server'%20-Location%20'Australia%20East'%20-ResourceGroupName%20'xxx'%0A2022-04-05T23%3A26%3A39.3831973Z%20%23%23%5Berror%5DThe%20script%20'Deploy-Aztemplate.ps1'%20cannot%20be%20run%20because%20the%20following%20modules%20that%20are%20specified%20by%20the%20%22%23requires%22%20statements%20of%20the%20script%20are%20missing%3A%20Az.Resources.%0A2022-04-05T23%3A26%3A39.4790248Z%20%23%23%5Bsection%5DFinishing%3A%20AzurePowerShell%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eazure-pipeline.yml%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Etrigger%3A%3CBR%20%2F%3E-%20master%3C%2FP%3E%3CP%3Epool%3A%3CBR%20%2F%3EvmImage%3A%20windows-latest%3CBR%20%2F%3Esteps%3A%3CBR%20%2F%3E-%20task%3A%20AzurePowerShell%403%3CBR%20%2F%3Einputs%3A%3CBR%20%2F%3EazureSubscription%3A%20'xxx-xxx-xx'%3CBR%20%2F%3EScriptType%3A%20'FilePath'%3CBR%20%2F%3EScriptPath%3A%20'%24(System.DefaultWorkingDirectory)%2F.%2FDeploy-Aztemplate.ps1'%3CBR%20%2F%3EScriptArguments%3A%20-ArtifactStagingDirectory%20'%24(System.DefaultWorkingDirectory)%5Cquickstarts%5Cmicrosoft.sql%5Csql-logical-server'%20-Location%20'Australia%20East'%20-ResourceGroupName%20'dco-devtest-labs'%3CBR%20%2F%3EazurePowerShellVersion%3A%20'latestversion'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3277143%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EX%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3277150%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20ARM%20Template%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3277150%22%20slang%3D%22en-US%22%3EHello.%3CBR%20%2F%3E%3CBR%20%2F%3EBe%20careful%20when%20you%20post%20code%20snippets%2Flogs%20in%20public%20forum%20like%20this.%20In%20your%20logs%20posted%20above%20-%20you%20have%20given%20away%20your%20TenantId%20and%20Subscription%20Id.%20Those%20are%20secrets%20to%20you.%20dont%20share%20it%20anywhere.%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi,

 

I am trying to deploy the arm template using the azure devops and getting the below errors.

 

2022-04-05T23:26:12.1776465Z ## Validating Inputs
2022-04-05T23:26:12.1904516Z ## Validating Inputs Complete
2022-04-05T23:26:12.1921198Z ## Initializing Azure
2022-04-05T23:26:12.6336103Z Added TLS 1.2 in session.
2022-04-05T23:26:13.9432297Z ##[command]Import-Module -Name C:\Modules\azurerm_6.13.1\AzureRM\6.13.1\AzureRM.psd1 -Global
2022-04-05T23:26:32.7370919Z ##[command]Clear-AzureRmContext -Scope Process
2022-04-05T23:26:34.0422406Z ##[command]Disable-AzureRmContextAutosave -ErrorAction Stop
2022-04-05T23:26:36.3893461Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant xxx -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope
2022-04-05T23:26:38.4440610Z ##[command] Select-AzureRMSubscription -SubscriptionId xxx -TenantId xxx
2022-04-05T23:26:38.9096942Z ## Initializing Azure Complete
2022-04-05T23:26:38.9129374Z ## Beginning Script Execution
2022-04-05T23:26:39.0519074Z ##[command]& 'D:\a\1\s\Deploy-Aztemplate.ps1' -ArtifactStagingDirectory 'D:\a\1\s\quickstarts\microsoft.sql\sql-logical-server' -Location 'Australia East' -ResourceGroupName 'xxx'
2022-04-05T23:26:39.3831973Z ##[error]The script 'Deploy-Aztemplate.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Az.Resources.
2022-04-05T23:26:39.4790248Z ##[section]Finishing: AzurePowerShell

 

 

azure-pipeline.yml 

 

trigger:
- master

pool:
vmImage: windows-latest
steps:
- task: AzurePowerShell@3
inputs:
azureSubscription: 'xxx-xxx-xx'
ScriptType: 'FilePath'
ScriptPath: '$(System.DefaultWorkingDirectory)/./Deploy-Aztemplate.ps1'
ScriptArguments: -ArtifactStagingDirectory '$(System.DefaultWorkingDirectory)\quickstarts\microsoft.sql\sql-logical-server' -Location 'Australia East' -ResourceGroupName 'dco-devtest-labs'
azurePowerShellVersion: 'latestversion'

 

 

  • X
1 Reply
Hello.

Be careful when you post code snippets/logs in public forum like this. In your logs posted above - you have given away your TenantId and Subscription Id. Those are secrets to you. dont share it anywhere.