Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.86k forks source link

Trying to Deploy bicep module to the Azure Stack Hub #23415

Closed Chirag1233 closed 11 months ago

Chirag1233 commented 1 year ago

Description

Hi There, I am trying to install the ARM template and Bicep template to the Azure Stack hub using the New-AzResourceGroupDeployment. However, I have an older version mentioned in my template but when I deploy using the New-AzResourceGroupDeployment it keep coming up as invalidAPIVersion error.

Here is the sample of my ARM template: { "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", "contentVersion": "1.0.0.0", "resources": [ { "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2017-10-01", "name": "testvnet", "properties": { "addressSpace": { "addressPrefixes": [ "10.0.0.0/16" ] }, "subnets": [ { "name": "subnettest", "properties": { "addressPrefix": "10.0.0.0/24" } } ] } } ] }

and Here is my Bicep Template: resource hubvnet 'Microsoft.Network/virtualNetworks@2017-10-01' = { name: 'testvnet' properties: { addressSpace: { addressPrefixes: [ '10.0.0.0/16' ] } subnets: [ { name: 'subnettest' properties: { addressPrefix: '10.0.0.0/24' } } ] } }

But I am keep getting this error for both of the templates: `New-AzResourceGroupDeployment : 11:48:49 PM - Error: Code=InvalidApiVersionParameter; Message=The api-version '2020-10-01' is invalid. The supported versions are '2020-0 6-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01 ,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,201 5-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04,2015-11-01,2015-11-01'. At line:1 char:1

New-AzResourceGroupDeployment : The deployment validation failed At line:1 char:1

Script or Debug output

**Bicep Deployment Debug logs**
'DEBUG: 12:16:29 AM - NewAzureResourceGroupDeploymentCmdlet begin processing with ParameterSet 'ByTemplateFileWithNoParameters'.
DEBUG: 12:16:29 AM - using account id 'chiragd@azurestack.local'...
VERBOSE: Performing the operation "Creating Deployment" on target "RESOURGROUPNAME".
DEBUG: [Common.Authentication]: Authenticating using Account: 'TEST!@azurestack.local', environment: 'AzureStackUser', tenant: 'TENANTID'
DEBUG: 12:16:29 AM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'adfs', Scopes:'https://management.adfs.azurestack.local/TENANTID/openid', AuthorityHost:'https://adfs.local.azurestack.external/adfs/', UserId:'chiragd@azurestack.local'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.adfs.azurestack.local/TENANTID/openid ] ParentRequestId: 
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.adfs.azurestack.local/TENANTID/openid ] ParentRequestId:  E
xpiresOn: 2023-11-15T01:15:59.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'TENANTID', UserId: 'test1@azurestack.local'
New-AzResourceGroupDeployment : Unexpected character encountered while parsing value: r. Path '', line 0, position 0.
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName 'tesst' -TemplateFil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzResourceGroupDeployment], JsonReaderException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

DEBUG: AzureQoSEvent: CommandName - New-AzResourceGroupDeployment; IsSuccess - False; Duration - 00:00:00.1287183; Exception - Unexpected character encountered while pars
ing value: r. Path '', line 0, position 0.;
DEBUG: Finish sending metric.
DEBUG: 12:16:29 AM - NewAzureResourceGroupDeploymentCmdlet end processing.'

**I have create the ARM template out of the bicep using the bicep build command and when I deploy that this is what I get**
** ARM Template OutPut **
'DEBUG: 12:19:35 AM - NewAzureResourceGroupDeploymentCmdlet begin processing with ParameterSet 'ByTemplateFileWithNoParameters'.
DEBUG: 12:19:35 AM - using account id 'test@azurestack.local'...
VERBOSE: Performing the operation "Creating Deployment" on target "tesst".
DEBUG: [Common.Authentication]: Authenticating using Account: 'Test1=@azurestack.local', environment: 'AzureStackUser', tenant: 'TENANTID'
DEBUG: 12:19:35 AM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'adfs', Scopes:'https://management.adfs.azurestack.local/TENANTID/openid', AuthorityHost:'https://adfs.local.azurestack.external/adfs/', UserId:'Test@azurestack.local'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.adfs.azurestack.local/TENANTID/openid ] ParentRequestId: 
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.adfs.azurestack.local/TENANTID/openid ] ParentRequestId:  E
xpiresOn: 2023-11-15T01:15:59.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'TenantID', UserId: 'TEST1@azurestack.local'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.local.azurestack.external/subscriptions/c6b60bb1-fab9-460d-a3ba-701ae7026216/resourcegroups/tesst/providers/Microsoft.Resources/deployments/virtualNetw
ork/validate?api-version=2020-10-01

Headers:
x-ms-client-request-id        : ID
accept-language               : en-US

Body:
{
  "properties": {
    "template": {
      "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
      "contentVersion": "1.0.0.0",
      "metadata": {
        "_generator": {
          "name": "bicep",
          "version": "0.23.1.45101",
          "templateHash": "3351113752682010288"
        }
      },
      "resources": [
        {
          "type": "Microsoft.Network/virtualNetworks",
          "apiVersion": "2017-10-01",
          "name": "testvnet",
          "properties": {
            "addressSpace": {
              "addressPrefixes": [
                "10.0.0.0/16"
              ]
            },
            "subnets": [
              {
                "name": "subnettest",
                "properties": {
                  "addressPrefix": "10.0.0.0/24"
                }
              }
            ]
          }
        }
      ]
    },
    "parameters": {},
    "mode": "Incremental"
  }
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : ID
x-ms-correlation-request-id   : ID
x-ms-routing-request-id       : LOCAL:20231115T001935Z:ID
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Wed, 15 Nov 2023 00:19:35 GMT

Body:
{
  "error": {
    "code": "InvalidApiVersionParameter",
    "message": "The api-version '2020-10-01' is invalid. The supported versions are '2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-
01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,20
17-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04,20
15-11-01,2015-11-01'."
  }
}

New-AzResourceGroupDeployment : 12:19:35 AM - Error: Code=InvalidApiVersionParameter; Message=The api-version '2020-10-01' is invalid. The supported versions are '2020-0
6-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01
,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,201
5-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04,2015-11-01,2015-11-01'.
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName "RGNAME" -TemplateFil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzResourceGroupDeployment : The deployment validation failed
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName "RGNAME" -TemplateFil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzResourceGroupDeployment], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

DEBUG: AzureQoSEvent: CommandName - New-AzResourceGroupDeployment; IsSuccess - False; Duration - 00:00:00.3355565; Exception - The deployment validation failed;
DEBUG: Finish sending metric.
DEBUG: 12:19:41 AM - NewAzureResourceGroupDeploymentCmdlet end processing.

PS C:\Windows\system32> '

** I have Notice that the Absolute Uri has the API Version which does not match to the ARM template or Bicep not sure if I am missing anything here https://management.local.azurestack.external/subscriptions/c6b60bb1-fab9-460d-a3ba-701ae7026216/resourcegroups/tesst/providers/Microsoft.Resources/deployments/virtualNetw
ork/validate?api-version=2020-10-01 **

Environment data

Name                           Value                                                                                                                                     
----                           -----                                                                                                                                     
PSVersion                      5.1.17763.10848                                                                                                                           
PSEdition                      Desktop                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                   
BuildVersion                   10.0.17763.10848                                                                                                                          
CLRVersion                     4.0.30319.42000                                                                                                                           
WSManStackVersion              3.0                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                       
SerializationVersion           1.1.0.1

Module versions

PS C:\Windows\system32> Get-Module Az*

ModuleType Version    Name                                ExportedCommands                                                                                               
---------- -------    ----                                ----------------                                                                                               
Script     2.2.8      Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount...}                                    
Script     3.1.1      Az.Resources                        {Add-AzADGroupMember, Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzADAppCredential...}

Error output

PS C:\Windows\system32> Resolve-AzError
DEBUG: 12:26:19 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 12:26:19 AM - using account id 'chiragd@azurestack.local'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

   HistoryId: 8

Message        : The deployment validation failed
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleException(ExceptionDispatchInfo capturedException)
                    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.InvalidOperationException
InvocationInfo : {New-AzResourceGroupDeployment}
Line           : New-AzResourceGroupDeployment -ResourceGroupName "RGNAME" -TemplateFile "C:\Users\azurestackadmin\Documents\Automation\Modules\virtualNetwork.json" 
                 -Verbose
Position       : At line:1 char:1
                 + New-AzResourceGroupDeployment -ResourceGroupName "RGNAME" -TemplateFil ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 8

Message        : 12:19:35 AM - Error: Code=InvalidApiVersionParameter; Message=The api-version '2020-10-01' is invalid. The supported versions are '2020-06-01,2020-05-01
                 ,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-
                 01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-0
                 2-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04,2015-11-01,2015-11-01'.

StackTrace     : 
Exception      : System.Exception
InvocationInfo : {New-AzResourceGroupDeployment}
Line           : New-AzResourceGroupDeployment -ResourceGroupName "tesst" -TemplateFile "C:\Users\azurestackadmin\Documents\Automation\Modules\virtualNetwork.json" 
                 -Verbose
Position       : At line:1 char:1
                 + New-AzResourceGroupDeployment -ResourceGroupName "tesst" -TemplateFil ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 8

   HistoryId: 7

Message        : Unexpected character encountered while parsing value: r. Path '', line 0, position 0.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleException(ExceptionDispatchInfo capturedException)
                    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {New-AzResourceGroupDeployment}
Line           : New-AzResourceGroupDeployment -ResourceGroupName 'tesst' -TemplateFile "C:\Users\azurestackadmin\Documents\Automation\Modules\virtualNetwork.bicep" 
                 -Verbose
Position       : At line:1 char:1
                 + New-AzResourceGroupDeployment -ResourceGroupName 'tesst' -TemplateFil ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7

   HistoryId: 4

Message        : The term 'NuGet.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a 
                 path was included, verify that the path is correct and try again.
StackTrace     : 
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {Get-Command}
Line           :         $nugetCmd = Microsoft.PowerShell.Core\Get-Command -Name $script:NuGetExeName `

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11590 char:21
                 + ... $nugetCmd = Microsoft.PowerShell.Core\Get-Command -Name $script:NuGet ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4

Message        : Module Repository 'MyNuGetSource' exists.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {Register-PackageSource}
Line           :         $null = PackageManagement\Register-PackageSource @PSBoundParameters

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11587 char:17
                 + ...     $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4

   HistoryId: -1

Message        : Exception calling "GetAsync" with "1" argument(s): "Only 'http' and 'https' schemes are allowed.
                 Parameter name: requestUri"
StackTrace     :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.MethodInvocationException
InvocationInfo : {}
Line           :             $response = $httpclient.GetAsync($endpoint)

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:5422 char:13
                 +             $response = $httpclient.GetAsync($endpoint)
                 +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : -1

Message        : Only 'http' and 'https' schemes are allowed.
                 Parameter name: requestUri
StackTrace     :    at System.Net.Http.HttpRequestMessage.InitializeValues(HttpMethod method, Uri requestUri)
                    at System.Net.Http.HttpRequestMessage..ctor(HttpMethod method, Uri requestUri)
                    at System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken)
                    at CallSite.Target(Closure , CallSite , Object , Object )
Exception      : System.ArgumentException
InvocationInfo : {}
Line           :             $response = $httpclient.GetAsync($endpoint)

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:5422 char:13
                 +             $response = $httpclient.GetAsync($endpoint)
                 +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : -1

   HistoryId: 4

Message        : Cannot find a variable with the name 'PackageManagementProvider'.
StackTrace     : 
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :             if (Get-Variable -Name PackageManagementProvider -ErrorAction SilentlyContinue) {

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11422 char:17
                 + ...         if (Get-Variable -Name PackageManagementProvider -ErrorAction ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4

   HistoryId: 3

Message        : The 'Register-PSRepository' command was found in the module 'PowerShellGet', but the module could not be loaded. For more information, run 
                 'Import-Module PowerShellGet'.
StackTrace     :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                    at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           :  Register-PSRepository -Name $RepoName -SourceLocation $SourceLocation -InstallationPolicy Trusted

Position       : At line:9 char:2
                 +  Register-PSRepository -Name $RepoName -SourceLocation $SourceLocatio ...
                 +  ~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 3

   HistoryId: 1

Message        : The term 'Select-AzSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
                 or if a path was included, verify that the path is correct and try again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions 
                 searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
                    at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
                    at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
                    at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst 
                 commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, 
                 CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Select-AzSubscription -SubscriptionID "c6b60bb1-fab9-460d-a3ba-701ae7026216"
Position       : At line:8 char:1
                 + Select-AzSubscription -SubscriptionID "c6b60bb1-fab9-460d-a3ba-701ae7 ...
                 + ~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
                 if a path was included, verify that the path is correct and try again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions 
                 searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
                    at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
                    at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
                    at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst 
                 commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, 
                 CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Connect-AzAccount -EnvironmentName "AzureStackUser"

Position       : At line:5 char:1
                 + Connect-AzAccount -EnvironmentName "AzureStackUser"
                 + ~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : The term 'Add-AzEnvironment' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
                 if a path was included, verify that the path is correct and try again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions 
                 searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
                    at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
                    at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
                    at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst 
                 commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, 
                 CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Add-AzEnvironment -Name "AzureStackUser" -ArmEndpoint "https://management.local.azurestack.external"

Position       : At line:2 char:1
                 + Add-AzEnvironment -Name "AzureStackUser" -ArmEndpoint "https://manage ...
                 + ~~~~~~~~~~~~~~~~~
HistoryId      : 1

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.3653029
DEBUG: Finish sending metric.
DEBUG: 12:26:31 AM - ResolveError end processing.
isra-fel commented 1 year ago

@BethanyZhou please triage this. Thanks.

BethanyZhou commented 12 months ago

Hi @Chirag1233 , could you upgrade Az.Resources to latest version and paste latest debug log here? Latest version is 6.12.0 while yours is 3.1.1.

BTW, could you provide the detailed parameters used by New-AzResourceGroupDeployment? If I use New-AzResourceGroupDeployment -Name test -ResourceGroupName bez-rg -TemplateFile .\template.json with your sample template. The error message in my side is Status Message: The location property is required for this definition. (Code:LocationRequired).

microsoft-github-policy-service[bot] commented 11 months ago

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!