Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

New-AzContainInstanceObject has a localization issue #16082

Closed ykuijs closed 2 years ago

ykuijs commented 2 years ago

Description

When using the Dutch regional settings, decimals are written using a comma instead of a dot. When I want to create a new container and specify a decimal number for memoryInGB using the below cmdlets, I am getting an error message.

Az.ContainerInstance.internal\New-AzContainerGroup : The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 
'properties.containers[0].properties.resources.requests.memoryInGB', line 18, position 31.'.
At C:\Users\USERID\Documents\WindowsPowerShell\Modules\Az.ContainerInstance\2.1.0\custom\New-AzContainerGroup.ps1:411 char:7
+       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ SubscriptionI...dows"
  }
} }:<>f__AnonymousType8`4) [New-AzContainerGroup_CreateExpanded], Exception
    + FullyQualifiedErrorId : InvalidRequestContent,Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Cmdlets.NewAzContainerGroup_CreateExpanded

When I use the ToJsonString method for the container object, I am getting this (see the two commas in memoryInGB):

C:\> $container.ToJsonString()
{
  "properties": {
    "resources": {
      "requests": {
        "memoryInGB": 2,5,
        "cpu": 2
      }
    },
    "image": "mcr.microsoft.com/windows/servercore:ltsc2019",
    "command": [ "ping -t localhost" ],
    "ports": [
      {
        "protocol": "TCP",
        "port": 80
      }
    ]
  },
  "name": "testcontainer"
}

Steps to reproduce

$port1 = New-AzContainerInstancePortObject -Port 80 -Protocol TCP
$container = New-AzContainerInstanceObject -Name testcontainer -Image mcr.microsoft.com/windows/servercore:ltsc2019 -RequestCpu 2 -RequestMemoryInGb 2.5 -Port @($port1) -Command "ping -t localhost"
$containerGroup = New-AzContainerGroup -ResourceGroupName myrg -Name testcontainer -Location westeurope -Container $container -OsType Windows -RestartPolicy "Never" -IpAddressType Public

Environment data

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

Module versions

    Directory: C:\Users\USERID\Documents\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                                                            
---------- -------    ----                                ----------------                                                                                                                                            
Script     2.5.4      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}                                                 
Script     2.1.0      Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability...}                             
Script     0.7.3      posh-git                            {Invoke-NullCoalescing, Add-PoshGitToProfile, Get-PromptPath, Write-GitStatus...}                                                                           

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                                                            
---------- -------    ----                                ----------------                                                                                                                                            
Manifest   6.0.1      ActiveDirectoryDsc                  Find-DomainController                                                                                                                                       
Script     2.5.3      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}                                                 
Script     1.4.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration...}      
Script     2.2.3      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry...}                                               
Script     3.5.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation...}                       
Binary     2.0.2.136  AzureADPreview                      {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationExtensionProperty, Get-AzureADApplicationOwner...}                              
Manifest   1.3.0.0    DSCParser                           {ConvertTo-DSCObject, Get-VariableListFromDSC, Convert-CIMInstanceToPSObject, Get-HashtableFromGroup}                                                       
Script     2.0.5      ExchangeOnlineManagement            {Get-EXOCasMailbox, Get-EXOMailbox, Get-EXOMailboxFolderPermission, Get-EXOMailboxFolderStatistics...}                                                      
Script     1.7.0      Microsoft.Graph.Applications        {Add-MgApplicationKey, Add-MgApplicationPassword, Add-MgServicePrincipalKey, Add-MgServicePrincipalPassword...}                                             
Script     1.7.0      Microsoft.Graph.Authentication      {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Get-MgProfile...}                                                                                      
Script     1.6.0      Microsoft.Graph.Authentication      {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Get-MgProfile...}                                                                                      
Script     1.7.0      Microsoft.Graph.DeviceManagement    {Get-MgDeviceManagement, Get-MgDeviceManagementAdvancedThreatProtectionOnboardingStateSummary, Get-MgDeviceManagementAdvancedThreatProtectionOnboardingSt...
Script     1.7.0      Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementApplePushNotificationCertificate, Get-MgDeviceManagementAuditEvent, Get-MgDeviceManagementCartToClassAssociation, Get-MgDeviceMana...
Script     1.7.0      Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementAndroid, Get-MgDeviceManagementAndroidDeviceOwnerEnrollmentProfile, Get-MgDeviceManagementAppleUserInitiatedEnrollmentProfile, Get...
Script     1.7.0      Microsoft.Graph.Devices.Corporat... {Clear-MgDeviceAppMgtWindowInformationProtectionDeviceRegistration, Get-MgDeviceAppMgt, Get-MgDeviceAppMgtAndroidManagedAppProtection, Get-MgDeviceAppMgt...
Script     1.7.0      Microsoft.Graph.Groups              {Add-MgGroupFavorite, Add-MgGroupToLifecyclePolicy, Confirm-MgGroupGrantedPermission, Confirm-MgGroupMemberGroup...}                                        
Script     0.9.1      Microsoft.Graph.Groups.Planner      {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanBucketTask...}                                             
Script     1.7.0      Microsoft.Graph.Identity.Directo... {Confirm-MgAdministrativeUnitMemberGroup, Confirm-MgAdministrativeUnitMemberObject, Confirm-MgContactMemberGroup, Confirm-MgContactMemberObject...}         
Script     1.7.0      Microsoft.Graph.Identity.SignIns    {Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-MgIdentityConditionalAccessAuthenticationContextClasserenceByRef, Get-MgIdentityCondition...
Binary     6.1907.1.0 Microsoft.Graph.Intune              {New-AccessActionObject, New-ActivityHistoryItemObject, New-AlertHistoryStateObject, New-AlertObject...}                                                    
Script     1.7.0      Microsoft.Graph.Planner             {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanDetail...}                                                 
Script     1.6.0      Microsoft.Graph.Planner             {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanBucketTask...}                                             
Script     1.7.0      Microsoft.Graph.Teams               {Add-MgChatMember, Add-MgTeamChannelMember, Add-MgTeamMember, Add-MgTeamPrimaryChannelMember...}                                                            
Script     1.6.0      Microsoft.Graph.Teams               {Add-MgChatMember, Add-MgTeamChannelMember, Add-MgTeamMember, Add-MgTeamPrimaryChannelMember...}                                                            
Script     1.7.0      Microsoft.Graph.Users               {Get-MgUser, Get-MgUserCreatedObject, Get-MgUserCreatedObjectByRef, Get-MgUserDirectReport...}                                                              
Script     2.0.137    Microsoft.PowerApps.Administrati... {New-AdminPowerAppCdsDatabase, Get-AdminPowerAppCdsDatabaseLanguages, Get-AdminPowerAppCdsDatabaseCurrencies, Get-AdminPowerAppEnvironmentLocations...}     
Script     2.0.126    Microsoft.PowerApps.Administrati... {New-AdminPowerAppCdsDatabase, Get-AdminPowerAppCdsDatabaseLanguages, Get-AdminPowerAppCdsDatabaseCurrencies, Get-AdminPowerAppEnvironmentLocations...}     
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}                                                                                                       
Manifest   1.21.10... Microsoft365DSC                     {Assert-M365DSCBlueprint, Assert-M365DSCTemplate, Compare-M365DSCConfigurations, Export-M365DSCConfiguration...}                                            
Manifest   1.21.630.1 Microsoft365DSC                     {Assert-M365DSCBlueprint, Assert-M365DSCTemplate, Compare-M365DSCConfigurations, Export-M365DSCConfiguration...}                                            
Script     2.6.0      MicrosoftTeams                      {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-MicrosoftTeams, Get-MultiGeoRegion...}                                                                    
Binary     2.3.1      MicrosoftTeams                      {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-MicrosoftTeams, Get-MultiGeoRegion...}                                                                    
Script     1.0.72     MSCloudLoginAssistant               {Test-MSCloudLogin, Connect-M365Tenant, Invoke-MSCloudLoginMicrosoftGraphAPI, Connect-MSCloudLoginPowerPlatform...}                                         
Script     1.0.53     MSCloudLoginAssistant               {Test-MSCloudLogin, Invoke-MSCloudLoginMicrosoftGraphAPI, Connect-MSCloudLoginSecurityComplianceMFA, Connect-MSCloudLoginPowerPlatform...}                  
Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                      
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                      
Script     3.4.0      Pester                              {Describe, Context, It, Should...}                                                                                                                          
Manifest   1.7.0      PnP.PowerShell                      {Add-PnPClientSidePage, Add-PnPClientSidePageSection, Add-PnPClientSideText, Add-PnPClientSideWebPart...}                                                   
Manifest   1.6.0      PnP.PowerShell                      {Add-PnPClientSidePage, Add-PnPClientSidePageSection, Add-PnPClientSideText, Add-PnPClientSideWebPart...}                                                   
Script     2.2.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}                                                                                       
Script     2.2.4.1    PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}                                                                                       
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                                                                                
Script     1.4.150    PSFramework                         {ConvertTo-PSFHashtable, Invoke-PSFCallback, Invoke-PSFProtectedCommand, Remove-PSFNull...}                                                                 
Script     1.0.3.0    PSProfiler                          {Measure-Script, WhyScriptNoGoBrrrr}                                                                                                                        
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption...}                                                  
Manifest   2.0.0.7    ReverseDSC                          {Get-DSCParamType, Get-DSCBlock, Get-DSCFakeParameters, Get-DSCDependsOnBlock...}                                                                           
Manifest   1.4.0.0    WorkflowManagerDSC                  {Get-WmfDscInstalledProductVersion, Confirm-WmfDscEnvironmentVariables, Test-WFDSCObjectHasProperty, Remove-WMDscZoneMap...}                                

    Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                                                            
---------- -------    ----                                ----------------                                                                                                                                            
Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Set-AppBackgroundTaskResourcePolicy, Unregister-AppBackgroundTask...}       
Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy, Set-AppLockerPolicy...}                                                            
Manifest   1.0.0.0    AppvClient                          {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add-AppvPublishingServer, Disable-Appv...}                                                           
Manifest   2.0.1.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageAutoUpdateSettings, Get-AppxPackageManifest...}                                                           
Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}                                                                                              
Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtector...}                                                                    
Manifest   2.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer...}                                                                             
Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading...}                                                                             
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}                                                                               
Manifest   1.0        ConfigCI                            {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIPolicy...}                                                                                         
Manifest   1.0        ConfigDefender                      {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}                                                                              
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}                                                                              
Manifest   1.0.3.0    DeliveryOptimization                {Get-DeliveryOptimizationLog, Get-DeliveryOptimizationLogAnalysis, Delete-DeliveryOptimizationCache, Disable-DeliveryOptimizationVerboseLogs...}            
Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DAClientExperienceConfiguration, Get-DAEntryPointTableItem...}                
Script     3.0        Dism                                {Add-AppProvisionedSharedPackageContainer, Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability...}                                         
Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache...}                                                                               
Manifest   1.0.0.0    EventTracingManagement              {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTraceSession...}                                                                
Script     2021.3.... Get-NetView                         Get-NetView                                                                                                                                                 
Manifest   1.0.0.0    HgsClient                           {Get-HgsAttestationBaselinePolicy, Get-HgsClientConfiguration, Test-HgsClientConfiguration, Set-HgsClientConfiguration...}                                  
Manifest   1.0.0.0    HgsDiagnostics                      {New-HgsTraceTarget, Get-HgsTrace, Get-HgsTraceFileData, Test-HgsTraceTarget}                                                                               
Manifest   1.0.0.1    HostNetworkingService               {Remove-HnsNamespace, Remove-HnsEndpoint, Get-HnsEndpoint, Remove-HnsPolicyList...}                                                                         
Manifest   2.0.0.0    Hyper-V                             {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMGpuPartitionAdapter...}                                                               
Manifest   1.1        Hyper-V                             {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHardDiskDrive, Add-VMMigrationNetwork...}                                                                     
Manifest   2.1.0.0    International                       {Copy-UserInternationalSettingsToSystem, Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHomeLocation...}                      
Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal, Update-IscsiTargetPortal...}                                                       
Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}                                                                                                         
Manifest   1.0.0.0    Kds                                 {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration...}                                                                                  
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                                                                                                                          
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}                                                                                              
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                                                                                                         
Manifest   1.0.0.0    Microsoft.PowerShell.LocalAccounts  {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup...}                                                                              
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}                                                                                              
Script     1.0        Microsoft.PowerShell.ODataUtils     Export-ODataEndpointProxy                                                                                                                                   
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}                                                                                                   
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                                                                                                  
Manifest   1.0.0      Microsoft.Windows.Bcd.Cmdlets       {Copy-BcdEntry, Disable-BcdElementBootDebug, Disable-BcdElementBootEms, Disable-BcdElementDebug...}                                                         
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...}                                                                      
Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...}                                                                                              
Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTransaction, Join-DtcDiagnosticResourceManager, Receive-DtcDiagnosticTransaction...}                   
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload, Disable-NetAdapterEncapsulatedPacketTaskOffload...}                      
Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProfile}                                                                                                        
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSession...}                                                                  
Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember...}                                                                      
Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession...}                                                                      
Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}                                                                                 
Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetIPsecQuickModeCryptoProposal...}                                  
Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam...}                                                                       
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol...}                                                                         
Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguration, Set-NCSIPolicyConfiguration}                                           
Manifest   1.0.0.0    NetworkSwitchManager                {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-NetworkSwitchEthernetPort, Remove-NetworkSwitchEthernetPortIPAddress...}          
Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHttpsProfile, Disable-NetNatTransitionConfiguration...}                     
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice...}                                                                                  
Binary     1.0.0.0    PersistentMemory                    {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegion, New-PmemDisk...}                                                                               
Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate, Get-CertificateAutoEnrollmentPolicy...}                                  
Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}                                                                                 
Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration...}                                                                                
Binary     1.0.12     ProcessMitigations                  {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy}                                                                           
Script     3.0        Provisioning                        {Install-ProvisioningPackage, Export-ProvisioningPackage, Install-TrustedProvisioningCertificate, Export-Trace...}                                          
Manifest   1.1        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConfiguration, Test-DscConfiguration, Publish-DscConfiguration...}                                              
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...}                                                                      
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}                                                                                      
Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}                                                                                                
Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow                                                                                                                                           
Manifest   1.0.0.0    ScheduledTasks                      {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-ScheduledTask...}                                                                 
Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBootUEFI...}                                                                  
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess...}                                                                                      
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}                                                                                              
Manifest   1.0.0.1    StartLayout                         {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-StartApps}                                                                       
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain...}                                                         
Manifest   1.0.0.0    StorageBusCache                     {Clear-StorageBusDisk, Disable-StorageBusCache, Disable-StorageBusDisk, Enable-StorageBusCache...}                                                          
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-TlsSessionTicketKey...}                                           
Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}                                                                                                       
Manifest   2.0.0.0    TrustedPlatformModule               {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}                                                                                                        
Binary     2.1.639.0  UEV                                 {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-UevBackup, Set-UevTemplateProfile...}                                                                
Script     1.0.0.0    VMDirectStorage                     {Get-VMDirectVirtualDisk, Add-VMDirectVirtualDisk, Remove-VMDirectVirtualDisk, mvmr...}                                                                     
Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection...}                                                                          
Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}                                                                                               
Manifest   2.0.0.0    Whea                                {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}                                                                                                                
Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-WindowsDeveloperLicenseRegistration}                                                 
Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorReporting}                                                                    
Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSetting}                                                                                                        
Manifest   1.0.0.0    WindowsUpdate                       Get-WindowsUpdateLog                                                                                                                                        

    Directory: C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                                                            
---------- -------    ----                                ----------------                                                                                                                                            
Manifest   1.0        SQLPS                               {Backup-SqlDatabase, Save-SqlMigrationReport, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp...}                                     

    Directory: C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell

ModuleType Version    Name                                ExportedCommands                                                                                                                                            
---------- -------    ----                                ----------------                                                                                                                                            
Binary     2.6.111.0  AzureInformationProtection          {Clear-AIPAuthentication, Get-AIPFileStatus, New-AIPCustomPermissions, Export-AIPLogs...}                                                                   

Debug output

DEBUG: 15:38:02 - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing: 
DEBUG: CmdletProcessRecordStart: 
DEBUG: [CmdletProcessRecordAsyncStart]: Created new QosEvent for command 'New-AzContainerGroup_CreateExpanded'
DEBUG: CmdletProcessRecordAsyncStart: 
DEBUG: CmdletGetPipeline: 
DEBUG: CmdletBeforeAPICall: 
DEBUG: URLCreated: /subscriptions/0dcc273f-22d9-4775-9938-4309106ded7d/resourceGroups/myrg/providers/Microsoft.ContainerInstance/containerGroups/testcontainer?api-version=2021-03-01
DEBUG: RequestCreated: /subscriptions/0dcc273f-22d9-4775-9938-4309106ded7d/resourceGroups/myrg/providers/Microsoft.ContainerInstance/containerGroups/testcontainer?api-version=2021-03-01
DEBUG: HeaderParametersAdded: 
DEBUG: BodyContentSet: 
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/0dcc273f-22d9-4775-9938-4309106ded7d/resourceGroups/myrg/providers/Microsoft.ContainerInstance/containerGroups/testcontainer?api-version=2021-03-01

Headers:
x-ms-unique-id                : 22
x-ms-client-request-id        : 35eabe7e-fe57-4ddc-b9e5-5ad5820f7c0c
CommandName                   : Az.ContainerInstance.internal\New-AzContainerGroup
FullCommandName               : New-AzContainerGroup_CreateExpanded
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v0.0.0

Body:
{
  "location": "westeurope",
  "properties": {
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Public"
    },
    "containers": [
      {
        "properties": {
          "resources": {
            "requests": {
              "memoryInGB": 2,5,
              "cpu": 2
            }
          },
          "image": "mcr.microsoft.com/windows/servercore:ltsc2019",
          "command": [ "ping -t localhost" ],
          "ports": [
            {
              "protocol": "TCP",
              "port": 80
            }
          ]
        },
        "name": "testcontainer"
      }
    ],
    "restartPolicy": "Never",
    "osType": "Windows"
  }
}

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

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : a1e4905b-63f4-4d08-a355-1ad46ac43064
x-ms-correlation-request-id   : a1e4905b-63f4-4d08-a355-1ad46ac43064
x-ms-routing-request-id       : WESTEUROPE:20211013T133802Z:a1e4905b-63f4-4d08-a355-1ad46ac43064
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Wed, 13 Oct 2021 13:38:02 GMT

Body:
{
  "error": {
    "code": "InvalidRequestContent",
    "message": "The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 'properties.containers[0].properties.resources.requests.memoryInGB', line 18,
 position 31.'."
  }
}

DEBUG: ResponseCreated: 
DEBUG: BeforeResponseDispatch: 
Az.ContainerInstance.internal\New-AzContainerGroup : The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 
'properties.containers[0].properties.resources.requests.memoryInGB', line 18, position 31.'.
At C:\Users\USERID\Documents\WindowsPowerShell\Modules\Az.ContainerInstance\2.1.0\custom\New-AzContainerGroup.ps1:411 char:7
+       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ SubscriptionI...dows"
  }
} }:<>f__AnonymousType8`4) [New-AzContainerGroup_CreateExpanded], Exception
    + FullyQualifiedErrorId : InvalidRequestContent,Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Cmdlets.NewAzContainerGroup_CreateExpanded
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally: 
DEBUG: CmdletAfterAPICall: 
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd: 
DEBUG: CmdletProcessRecordEnd: 
DEBUG: AzureQoSEvent: Module: Az.ContainerInstance:2.1.0.0; CommandName: New-AzContainerGroup_CreateExpanded; PSVersion: ; IsSuccess: False; Duration: 00:00:00; Exception: InternalException;
DEBUG: Finish sending metric.
DEBUG: CmdletEndProcessing:

Error output

DEBUG: Sought all Az modules and got latest version 0.0.0
DEBUG: 15:39:17 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 15:39:17 - using account id '4a3f08a7-6879-4ac8-9948-9461d6f157c8'...
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: 17

Message        : [InvalidRequestContent] : The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 
                 'properties.containers[0].properties.resources.requests.memoryInGB', line 18, position 31.'.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {New-AzContainerGroup_CreateExpanded}
Line           :       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundParameters

Position       : At C:\Users\USERID\Documents\WindowsPowerShell\Modules\Az.ContainerInstance\2.1.0\custom\New-AzContainerGroup.ps1:411 char:7
                 +       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
                 +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 17

   HistoryId: 11

Message        : [InvalidRequestContent] : The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 
                 'properties.containers[0].properties.resources.requests.memoryInGB', line 18, position 31.'.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {New-AzContainerGroup_CreateExpanded}
Line           :       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundParameters

Position       : At C:\Users\USERID\Documents\WindowsPowerShell\Modules\Az.ContainerInstance\2.1.0\custom\New-AzContainerGroup.ps1:411 char:7
                 +       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
                 +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 11

   HistoryId: -1

Message        : Cannot find an overload for "ToJson" and the argument count: "0".
StackTrace     :    at CallSite.Target(Closure , CallSite , Object )
                    at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
                    at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.MethodException
InvocationInfo : {}
Line           : $container.ToJson()
Position       : At line:1 char:1
                 + $container.ToJson()
                 + ~~~~~~~~~~~~~~~~~~~
HistoryId      : -1

   HistoryId: 7

Message        : [InvalidRequestContent] : The request content was invalid and could not be deserialized: 'Invalid JavaScript property identifier character: ,. Path 
                 'properties.containers[0].properties.resources.requests.memoryInGB', line 18, position 31.'.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {New-AzContainerGroup_CreateExpanded}
Line           :       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundParameters

Position       : At C:\Users\USERID\Documents\WindowsPowerShell\Modules\Az.ContainerInstance\2.1.0\custom\New-AzContainerGroup.ps1:411 char:7
                 +       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
                 +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7

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

DEBUG: AzureQoSEvent: Module: Az.Accounts:2.5.4; CommandName: Resolve-AzError; PSVersion: 5.1.22000.65; IsSuccess: True; Duration: 00:00:00.2799452
DEBUG: Finish sending metric.
DEBUG: 15:39:18 - ResolveError end processing.
dingmeng-xue commented 2 years ago

@dolauli , please look into this issue.

dolauli commented 2 years ago

The root cause of the issue is in the generator autorest.powershell. And there already is an issue to track it. please see https://github.com/Azure/autorest.powershell/issues/772 for details. And before the issue is fixed in the generator, we could work around it by setting a culture, which use dot for float number. For example, Set-Culture en-US

dolauli commented 2 years ago

We have fixed the issue in generator in the PR -- https://github.com/Azure/autorest.powershell/pull/855. And this issue should be fixed in next release of Az.ContainerInstance.

BethanyZhou commented 2 years ago

Close this issue as Az.ContainerInstance is going to release in current milestone.