azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Set-AzSecurityPricing -Name "default" does not work

Open aws-scripting-guy opened this issue 6 years ago • 14 comments

Description

Expected behavior - I am able to enable Security Center on a subscription level with a single command. This can be done via ARM: https://techcommunity.microsoft.com/t5/azure-security-center/managing-security-center-at-scale-using-arm-templates-and-azure/ba-p/327761

Actual behavior - cmd-let supports only pricing scopes for Security Center

Set-AzSecurityPricing -Name default -PricingTier standard
Set-AzSecurityPricing : The name 'default' is not a valid name. Possible pricing bundle names: VirtualMachines, SqlServers, AppServices, StorageAccounts, SqlServerVirtualMachines, KubernetesService, ContainerRegistry, KeyVaults.
At line:1 char:1
+ Set-AzSecurityPricing -Name default -PricingTier standard
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Set-AzSecurityPricing], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Security.Cmdlets.Pricings.SetPricings

Steps to reproduce


Set-AzSecurityPricing -Name "default" -PricingTier "Standard"

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

get-module -list
ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.7.0      Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave…}
Script     1.6.0      Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave…}
Script     1.1.0      Az.AnalysisServices                 Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer…}
Script     1.2.0      Az.ApiManagement                    Core,Desk {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup…}
Script     1.0.0      Az.ApplicationInsights              Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplicationInsightsPricingPlan…}
Script     1.3.0      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration…}
Script     1.1.0      Az.Batch                            Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount…}
Script     1.3.0      Az.Cdn                              Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile…}
Script     2.4.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet…}
Script     1.0.1      Az.ContainerInstance                Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script     1.0.1      Az.ContainerRegistry                Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry…}
Script     1.1.2      Az.DataFactory                      Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2…}
Script     1.0.0      Az.DataLakeAnalytics                Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogCredential, Set-AzDataLakeAnalyticsCatalogCredential…}
Script     1.2.1      Az.DataLakeStore                    Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirewallRule, Set-AzDataLakeStoreTrustedIdProvider…}
Script     1.2.0      Az.EventHub                         Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubNamespace…}
Script     2.0.0      Az.HDInsight                        Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapReduceJobDefinition…}
Script     1.2.0      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation…}
Script     1.2.1      Az.LogicApp                         Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBatchConfiguration, Get-AzIntegrationAccountCallbackUrl…}
Script     1.2.1      Az.Monitor                          Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile…}
Script     1.11.0     Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-AzApplicationGatewayAuthenticationCertificate, Remove-AzApplicationGatewayAut…
Script     1.1.0      Az.NotificationHubs                 Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotificationHubPNSCredential…}
Script     1.3.1      Az.OperationalInsights              Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsights…
Script     1.1.2      Az.PolicyInsights                   Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation…}
Script     1.1.0      Az.RedisCache                       Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedisCachePatchSchedule…}
Script     1.6.0      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment…}
Script     0.7.7      Az.Security                         Core,Desk {Get-AzSecurityAlert, Set-AzSecurityAlert, Get-AzSecurityAutoProvisioningSetting, Set-AzSecurityAutoProvisioningSetting…}
Script     1.2.1      Az.ServiceBus                       Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamespace…}
Script     1.1.1      Az.ServiceFabric                    Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode…}
Script     1.13.0     Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseUpgradeHint…}
Script     1.5.0      Az.Storage                          Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey…}
Script     1.0.0      Az.StreamAnalytics                  Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFunction, Remove-AzStreamAnalyticsFunction…}
Script     1.0.1      Az.TrafficManager                   Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Remove-AzTrafficManagerCustomHeaderFromProfile…}
Script     1.3.0      Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan…}
Script     4.3.0      AzSK                                Desk      {Get-AzSKAccessToken, Get-AzSKSupportedResourceTypes, Set-AzSKPolicySettings, Get-AzSKAzureServicesSecurityStatus…}

aws-scripting-guy avatar Jan 07 '20 08:01 aws-scripting-guy

@aws-scripting-guy , could you call Get-AzSecurityPricing and check whether there is "default" one?

dingmeng-xue avatar Jan 07 '20 11:01 dingmeng-xue

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

ghost avatar Jan 09 '20 03:01 ghost

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

ghost avatar Jan 09 '20 03:01 ghost

We also notice the reference is using default as well. Security team, please check if it is doc issue.

dingmeng-xue avatar Jan 09 '20 03:01 dingmeng-xue

Do we have any update? What should we use instead of "default"?

Set-AzSecurityPricing : The name 'default' is not a valid name. Possible pricing bundle names: VirtualMachines, SqlServers, AppServices, StorageAccounts, SqlServerVirtualMachines, KubernetesService, ContainerRegistry, KeyVaults. At line:1 char:1

  • Set-AzSecurityPricing -Name "default" -PricingTier "Standard"
  •   + CategoryInfo          : CloseError: (:) [Set-AzSecurityPricing], CloudException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Security.Cmdlets.Pricings.SetPricings
    

Tan-Hassan avatar May 28 '20 06:05 Tan-Hassan

Is there an update? I'm not able to use default scope or any of the scopes suggested:

default: error is "set-azsecuritypricing : The name 'default' is not a valid name. Possible pricing bundle names: VirtualMachines, SqlServers, AppServices, StorageAccounts, SqlServerVirtualMachines, KubernetesService, ContainerRegistry, KeyVaults."

VirtualMachines: error is "Set-AzSecurityPricing : Another update operation is in progress"

0.7.9 Az.Security

shuttlek avatar Jun 30 '20 18:06 shuttlek

@chlahav , could you or your team to look into this issue?

dingmeng-xue avatar Jul 01 '20 06:07 dingmeng-xue

Setting it to individual services works but default still an issue.

Set-AzSecurityPricing -Name "VirtualMachines" -PricingTier "Standard" Set-AzSecurityPricing -Name "SqlServers" -PricingTier "Standard" Set-AzSecurityPricing -Name "AppServices" -PricingTier "Standard" Set-AzSecurityPricing -Name "StorageAccounts" -PricingTier "Standard" Set-AzSecurityPricing -Name "SqlServerVirtualMachines" -PricingTier "Standard" Set-AzSecurityPricing -Name "KubernetesService" -PricingTier "Standard" Set-AzSecurityPricing -Name "ContainerRegistry" -PricingTier "Standard" Set-AzSecurityPricing -Name "KeyVaults" -PricingTier "Standard"

Tan-Hassan avatar Jul 02 '20 00:07 Tan-Hassan

chlahav doesn't own this now. Looking for appropriate replacement contact.

AddySanto avatar Nov 16 '20 11:11 AddySanto

'default' is a parameter used for old API version. the current Powershell uses new api version which contains defender plan name and pricing tier, here is the relevant documentation: Set-AzSecurityPricing.

amitbiton1988 avatar Nov 22 '20 13:11 amitbiton1988

Hi @tanhassator

for the latest PS version 7.1.3 using the Azure Cloud Shell still the below command do not work scope to a particular resource . It does not work setting to individual services also but works with default. Any help ?

Set-AzSecurityPricing -Name "VirtualMachines" -PricingTier "Standard"

Set-AzSecurityPricing: Pricing name 'VirtualMachines' is not allowed. Expected 'default' for this scope.

dasamit13 avatar Aug 11 '21 05:08 dasamit13

Hi @dasamit13 ,

Can you please make sure that the az.security module is updated to the latest version?

Please use "update-module az.security" to update to the latest version.

amitbiton1988 avatar Aug 11 '21 11:08 amitbiton1988

@aws-scripting-guy Following up to know if you still are facing this issue.

SaurabhSharma-MSFT avatar Nov 16 '21 02:11 SaurabhSharma-MSFT

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!

ghost avatar Nov 23 '21 08:11 ghost