Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.2k stars 3.8k forks source link

Cannot create StandardV2 new stream analytics jobs using New-AzStreamAnalyticsJob #23016

Open Akshat59 opened 10 months ago

Akshat59 commented 10 months ago

Description

Cannot create StandardV2 new stream analytics jobs using New-AzStreamAnalyticsJob Can create "standard" SAJ but not 'v2' version. No way to provide api version

Command Used New-AzStreamAnalyticsJob -ResourceGroupName 'rg-poc6' -name 'rg-saj-1' -location 'eastus2' -SkuName "StandardV2"

Error: Az.StreamAnalytics.internal\New-AzStreamAnalyticsJob : Feature or property 'sku.name' is not supported in API version 2017-04-01-preview. Please use API version 2021-10-01-preview. At C:\Users\akshat_soni\Documents\WindowsPowerShell\Modules\Az.StreamAnalytics\2.0.0\custom\New-AzStreamAnalyticsJob.ps1:315 char:11

Issue script & Debug output

New-AzStreamAnalyticsJob -ResourceGroupName 'gts-eus2-app-poc6' -name 'gts-eus2-app-poc6-saj-5007' -location 'eastus2' -SkuName "StandardV2"
DEBUG: 12:46:52 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 12:46:52 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:46:52 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:46:52 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.1; CommandName: Get-AzContext; PSVersion: 5.1.22000.2538; IsSuccess: True; Duration: 00:00:00.0169001
DEBUG: 12:46:52 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:46:52 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing: 
DEBUG: CmdletProcessRecordStart: 
DEBUG: [CmdletProcessRecordAsyncStart]: Created new QosEvent for command 'New-AzStreamAnalyticsJob_CreateExpanded'
DEBUG: CmdletProcessRecordAsyncStart: 
DEBUG: CmdletGetPipeline: 
DEBUG: CmdletBeforeAPICall: 
DEBUG: URLCreated: /subscriptions/cb9d22e2-0531-4c2e-91a5-afa7e01e0500/resourceGroups/gts-eus2-app-poc6/providers/Microsoft.StreamAnalytics/streamingjobs/gts-eus2-app-poc6-s
aj-5007?api-version=2017-04-01-preview
DEBUG: RequestCreated: /subscriptions/cb9d22e2-0531-4c2e-91a5-afa7e01e0500/resourceGroups/gts-eus2-app-poc6/providers/Microsoft.StreamAnalytics/streamingjobs/gts-eus2-app-po
c6-saj-5007?api-version=2017-04-01-preview
DEBUG: HeaderParametersAdded: 
DEBUG: BodyContentSet: 
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
DEBUG: 12:46:52 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
PUT

Absolute Uri:
https://management.azure.com/subscriptions/cb9d22e2-0531-4c2e-91a5-afa7e01e0500/resourceGroups/gts-eus2-app-poc6/providers/Microsoft.StreamAnalytics/streamingjobs/gts-eus2-a
pp-poc6-saj-5007?api-version=2017-04-01-preview

Headers:
x-ms-unique-id                : 9
x-ms-client-request-id        : 94966b92-3f31-4658-9c26-d3db28d61ad5
CommandName                   : Az.StreamAnalytics.internal\New-AzStreamAnalyticsJob
FullCommandName               : New-AzStreamAnalyticsJob_CreateExpanded
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v0.0.0,PSVersion/v5.1.22000.2538,Az.StreamAnalytics/2.0.0

Body:
{
  "location": "eastus2",
  "properties": {
    "sku": {
      "name": "StandardV2"
    }
  }
}

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

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : 94966b92-3f31-4658-9c26-d3db28d61ad5
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : 2f1dc236-7ab3-4f12-bd50-5b311123ccc8
x-ms-routing-request-id       : CANADACENTRAL:20231018T164702Z:2f1dc236-7ab3-4f12-bd50-5b311123ccc8
X-Content-Type-Options        : nosniff
Cache-Control                 : no-store, no-cache
Date                          : Wed, 18 Oct 2023 16:47:01 GMT
Server                        : Kestrel

Body:
{
  "code": "BadRequest",
  "message": "Feature or property 'sku.name' is not supported in API version 2017-04-01-preview. Please use API version 2021-10-01-preview.",
  "details": {
    "code": "400",
    "message": "Feature or property 'sku.name' is not supported in API version 2017-04-01-preview. Please use API version 2021-10-01-preview.",
    "correlationId": "2f1dc236-7ab3-4f12-bd50-5b311123ccc8",
    "requestId": "94966b92-3f31-4658-9c26-d3db28d61ad5"
  }
}

DEBUG: ResponseCreated: 
DEBUG: [Finally]: Cannot deserialize due to Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IList`1[Microsoft.Rest.A
zure.CloudError]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like inte
ger, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserializ
e from a JSON object.
Path 'details.code', line 5, position 11.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally: 
DEBUG: CmdletProcessRecordEnd:

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                                                                                                  
---------- -------    ----                                ----------------                                                                                                  
Script     2.13.1     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                          
Script     2.2.1      Az.ApplicationInsights              {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKey, Get-AzApplicationInsightsContinuousExport, Get-AzA...
Script     6.5.1      Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}                        
Script     2.0.0      Az.StreamAnalytics                  {Get-AzStreamAnalyticsCluster, Get-AzStreamAnalyticsClusterStreamingJob, Get-AzStreamAnalyticsDefaultFunctionDe...

Error output

Az.StreamAnalytics.internal\New-AzStreamAnalyticsJob : Feature or property 'sku.name' is not supported in API version 2017-04-01-preview. Please use API version 2021-10-01-preview.

isra-fel commented 10 months ago

Thanks for the feedback. We'll plan the API version update. For now, please use "Invoke-AzRest" to work around this.

$payload = @{location="eastus2"; properties=@{sku=@{name="StandardV2"}}} | ConvertTo-Json -Depth 10
Invoke-AzRest -Method PUT -Uri "https://management.azure.com/subscriptions/******/resourceGroups/******/providers/Microsoft.StreamAnalytics/streamingjobs/******?api-version=2021-10-01-preview" -Payload $payload

(Replace "**" with your real subscription ID / resource group name / stream analytics job name.)