Azure / azure-powershell

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

Set-AzSecurityPricing -Name "AppServices" -PricingTier "Standard" throws error "Set-AzSecurityPricing: Internal server error has occurred" #23501

Open arunvkcop opened 1 year ago

arunvkcop commented 1 year ago

Description

I am trying to enable Defender for Cloud features using the PowerShell commands. Set-AzSecurityPricing -Name "AppServices" -PricingTier "Standard" throws an error "Set-AzSecurityPricing: Internal server error has occurred". It used to work on previous versions of Az PowerShell. Issue started appearing after I upgraded to Az 11.0.0.

Issue script & Debug output

Exception             : 
    Type       : Microsoft.Rest.Azure.CloudException
    Request    : 
        Method     : PUT
        RequestUri : https://management.azure.com/subscriptions/7f01d09b-26a9-4720-a879-5a0ac68c787b/providers/Microsoft.Security/pricings/AppServices?api-version=2023-01-01
        Content    : {}
        Headers    : 
            Accept-Language : REDACTED
            Authorization : …
            User-Agent : FxVersion/7.0.323.6910 OSName/MacOs OSVersion/Darwin.23.1.0.Darwin.Kernel.Version.23.1.0.Mon.Oct.9.21.27.27.PDT.2023.root.xnu.10002.41.9.6RELEASE.X86.64 Microsoft.Azure.Management.Security.SecurityCenterClient/4.0.0.0 
PSVersion/v7.3.3 AzurePowershell/v11.0.0 Az.Security/1.5.0
            CommandName : REDACTED
            ParameterSetName : REDACTED
            x-ms-client-request-id : 2032bdb6-38bb-48fc-add8-6266ee9d3e31
            Content-Type : application/json; charset=utf-8
            Content-Length : 2

    Response   : 
        StatusCode   : InternalServerError
        ReasonPhrase : Internal Server Error
        Content      : {"error":{"code":"GeneralError","message":"Internal server error has occurred"}}
        Headers      : 
            Cache-Control : no-cache
            Pragma : no-cache
            x-ms-ratelimit-remaining-subscription-resource-requests : 249
            Strict-Transport-Security : max-age=31536000; includeSubDomains
            api-supported-versions : 1.0
            Server : Kestrel
            x-ms-failure-cause : service
            x-ms-request-id : 1c3ff37d-746f-42f9-9381-ea21ce49f1cf
            x-ms-correlation-request-id : 1c3ff37d-746f-42f9-9381-ea21ce49f1cf
            x-ms-routing-request-id : SOUTHCENTRALUS:20231117T000504Z:1c3ff37d-746f-42f9-9381-ea21ce49f1cf
            X-Content-Type-Options : nosniff
            Date : Fri, 17 Nov 2023 00:05:04 GMT
            Connection : close
            Content-Length : 80
            Content-Type : application/json; charset=utf-8
            Expires : -1

    Body       : Microsoft.Rest.Azure.CloudError
    RequestId  : 1c3ff37d-746f-42f9-9381-ea21ce49f1cf
    TargetSite : 
        Name          : MoveNext
        DeclaringType : Microsoft.Azure.Management.Security.PricingsOperations+<UpdateWithHttpMessagesAsync>d__7, Microsoft.Azure.PowerShell.Security.Management.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : Microsoft.Azure.PowerShell.Security.Management.Sdk.dll
    Message    : Internal server error has occurred
    Data       : System.Collections.ListDictionaryInternal
    Source     : Microsoft.Azure.PowerShell.Security.Management.Sdk
    HResult    : -2146233088
    StackTrace : 
   at Microsoft.Azure.Management.Security.PricingsOperations.UpdateWithHttpMessagesAsync(String pricingName, Pricing pricing, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   at Microsoft.Azure.Commands.Security.Cmdlets.Pricings.SetPricings.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
   at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
   at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
CategoryInfo          : CloseError: (:) [Set-AzSecurityPricing], CloudException
FullyQualifiedErrorId : Microsoft.Azure.Commands.Security.Cmdlets.Pricings.SetPricings
InvocationInfo        : 
    MyCommand        : Set-AzSecurityPricing
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 11
    Line             : Set-AzSecurityPricing -Name "AppServices" -PricingTier "Standard"
    PositionMessage  : At line:1 char:1
                       + Set-AzSecurityPricing -Name "AppServices" -PricingTier "Standard"
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Set-AzSecurityPricing
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.3
PSEdition                      Core
GitCommitId                    7.3.3
OS                             Darwin 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Name                       Version
----                       -------
Az                         11.0.0
Az                         9.5.0
Az.Accounts                2.13.2
Az.Accounts                2.12.2
Az.Accounts                2.12.1
Az.Accounts                2.9.1
Az.Advisor                 2.0.0
Az.Aks                     6.0.0
Az.Aks                     5.3.1
Az.AnalysisServices        1.1.4
Az.ApiManagement           4.0.2
Az.App                     1.0.0
Az.AppConfiguration        1.3.0
Az.AppConfiguration        1.2.0
Az.ApplicationInsights     2.2.2
Az.ArcResourceBridge       1.0.0
Az.Attestation             2.0.0
Az.Automanage              1.0.0
Az.Automation              1.9.1
Az.Batch                   3.5.0
Az.Batch                   3.3.0
Az.Billing                 2.0.3
Az.Billing                 2.0.0
Az.Cdn                     3.1.1
Az.Cdn                     2.1.0
Az.CloudService            2.0.0
Az.CloudService            1.2.0
Az.CognitiveServices       1.14.1
Az.CognitiveServices       1.13.0
Az.Compute                 7.0.0
Az.Compute                 5.7.1
Az.Compute                 5.5.0
Az.ConfidentialLedger      1.0.0
Az.ContainerInstance       4.0.0
Az.ContainerInstance       3.2.0
Az.ContainerRegistry       4.1.2
Az.ContainerRegistry       3.0.2
Az.CosmosDB                1.13.0
Az.CosmosDB                1.9.1
Az.DataBoxEdge             1.1.0
Az.Databricks              1.7.1
Az.Databricks              1.5.0
Az.DataFactory             1.17.1
Az.DataFactory             1.16.13
Az.DataLakeAnalytics       1.0.3
Az.DataLakeAnalytics       1.0.2
Az.DataLakeStore           1.3.0
Az.DataProtection          2.1.0
Az.DataProtection          1.1.0
Az.DataShare               1.0.1
Az.DeploymentManager       1.1.0
Az.DesktopVirtualization   4.2.0
Az.DesktopVirtualization   3.1.1
Az.DevCenter               1.0.0
Az.DevTestLabs             1.0.2
Az.Dns                     1.2.0
Az.Dns                     1.1.2
Az.EventGrid               1.6.0
Az.EventGrid               1.5.0
Az.EventHub                4.2.0
Az.EventHub                3.2.2
Az.FrontDoor               1.10.0
Az.Functions               4.0.7
Az.Functions               4.0.6
Az.HDInsight               6.0.2
Az.HDInsight               5.0.1
Az.HealthcareApis          2.0.0
Az.IotHub                  2.7.5
Az.KeyVault                5.0.0
Az.KeyVault                4.9.2
Az.Kusto                   2.3.0
Az.Kusto                   2.1.0
Az.LoadTesting             1.0.0
Az.LogicApp                1.5.0
Az.MachineLearning         1.1.3
Az.MachineLearningServices 1.0.0
Az.Maintenance             1.4.0
Az.Maintenance             1.2.1
Az.ManagedServiceIdentity  1.1.1
Az.ManagedServices         3.0.0
Az.MarketplaceOrdering     2.0.0
Az.Media                   1.1.2
Az.Media                   1.1.1
Az.Migrate                 2.2.0
Az.Migrate                 2.1.0
Az.Monitor                 5.0.0
Az.Monitor                 4.4.1
Az.MySql                   1.1.1
Az.MySql                   1.1.0
Az.Network                 7.0.0
Az.Network                 5.5.0
Az.NetworkCloud            1.0.0
Az.NotificationHubs        1.1.2
Az.NotificationHubs        1.1.1
Az.OperationalInsights     3.2.0
Az.PolicyInsights          1.6.4
Az.PolicyInsights          1.6.0
Az.PostgreSql              1.1.0
Az.PowerBIEmbedded         2.0.0
Az.PowerBIEmbedded         1.2.0
Az.PrivateDns              1.0.4
Az.PrivateDns              1.0.3
Az.RecoveryServices        6.6.1
Az.RecoveryServices        6.3.0
Az.RedisCache              1.8.1
Az.RedisCache              1.7.1
Az.RedisEnterpriseCache    1.2.0
Az.RedisEnterpriseCache    1.1.0
Az.Relay                   2.0.0
Az.Relay                   1.0.4
Az.ResourceGraph           0.13.0
Az.ResourceMover           1.2.0
Az.ResourceMover           1.1.0
Az.Resources               6.12.0
Az.Resources               6.6.0
Az.Resources               6.5.3
Az.Security                1.5.0
Az.Security                1.4.0
Az.SecurityInsights        3.1.1
Az.SecurityInsights        3.0.1
Az.ServiceBus              3.0.0
Az.ServiceBus              2.2.0
Az.ServiceFabric           3.3.0
Az.ServiceFabric           3.1.1
Az.SignalR                 2.0.0
Az.SignalR                 1.5.0
Az.Sql                     4.11.0
Az.Sql                     4.4.0
Az.SqlVirtualMachine       2.1.0
Az.SqlVirtualMachine       1.1.0
Az.StackHCI                2.2.3
Az.StackHCI                1.4.3
Az.Storage                 6.0.0
Az.Storage                 5.4.1
Az.StorageMover            1.2.0
Az.StorageMover            1.0.0
Az.StorageSync             2.1.0
Az.StorageSync             1.7.0
Az.StreamAnalytics         2.0.0
Az.Support                 1.0.0
Az.Synapse                 3.0.4
Az.Synapse                 2.3.0
Az.TrafficManager          1.2.2
Az.TrafficManager          1.2.0
Az.Websites                3.1.2
Az.Websites                2.13.0
AzTable                    2.1.0
AzureAD                    2.0.2.182

Error output

No response

microsoft-github-policy-service[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @zivraf.

isra-fel commented 1 year ago

@VeryEarly can this issue be fixed by https://github.com/Azure/azure-powershell/pull/23492 ?

23499 as well. Thanks.