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

set-azsecuritycontact does not allow multiple emails

Open ikiris04 opened this issue 7 years ago • 6 comments

Description

Security Center allows for multiple emails but only one phone number via the portal. The cmdlet set-azurermsecuritycontact allows you to only set one email per cmdlet call and also requires a phone number. If you try to set a phone number with the second email then you get an error that it is not allows

Script/Steps for Reproduction


set-azurermsecuritycontact -name "default1" -email "[email protected]" -phone "1-888-888-8888" -alertadmin -notifyonalert
set-azurermsecuritycontact -name "default2" -email "[email protected]" -phone "" -alertadmin -notifyonalert
set-azurermsecuritycontact -name "default2" -email "[email protected]" -phone "1-888-888-8888" -alertadmin -notifyonalert

Module Version

Get-Module -ListAvailable

PS C:\users\ccey\code\AzureOperations\PowerShell\Subscriptions> get-module -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.3.0      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     1.0.1      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredentia...
Script     1.0.0      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServic...
Script     1.0.0      Az.ApiManagement                    {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, N...
Script     1.0.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Rem...
Script     1.1.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHyb...
Script     1.0.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAcc...
Script     1.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollme...
Script     1.0.1      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfil...
Script     1.0.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc...
Script     1.3.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAv...
Script     1.0.0      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzCont...
Script     1.0.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-...
Script     1.0.1      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFa...
Script     1.0.0      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalytic...
Script     1.0.2      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeSt...
Script     1.0.0      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic...
Script     1.0.0      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRe...
Script     1.1.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGr...
Script     1.0.0      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzE...
Script     1.0.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wa...
Script     1.0.2      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-A...
Script     1.0.1      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, ...
Script     1.1.0      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccou...
Script     1.0.0      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssocia...
Script     1.0.0      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.0.0      Az.Media                            {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Ge...
Script     1.0.0      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     1.1.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-Az...
Script     1.0.0      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorization...
Script     1.0.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-...
Script     1.0.0      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSu...
Script     1.0.0      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa...
Script     1.0.0      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServi...
Script     1.0.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheSchedul...
Script     1.0.0      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNa...
Script     1.1.2      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR...
Script     0.7.1      Az.Security                         {Get-AzSecurityAlert, Set-AzSecurityAlert, Get-AzSecurityA...
Script     1.0.0      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set...
Script     1.0.1      Az.ServiceFabric                    {Add-AzServiceFabricApplicationCertificate, Add-AzServiceF...
Script     1.0.2      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSig...
Script     1.2.0      Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlData...
Script     1.0.2      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor...
Script     1.0.0      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefau...
Script     0.7.1      Az.Subscription                     New-AzSubscription
Script     1.0.1      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTraf...
Script     1.1.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServ...
Binary     2.0.1.16   AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-...
Manifest   1.0.0.21   AzureRmStorageTable                 {Add-StorageTableRow, Get-AzureStorageTableRowAll, Get-Azu...
Script     4.0.8      ImportExcel                         {Import-UPS, ConvertFrom-ExcelSheet, Test-Number, Get-Rang...
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     3.4.0      Pester                              {Describe, Context, It, Should...}
Script     1.6.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remov...


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


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgro...
Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-Ap...
Manifest   1.0.0.0    AppvClient                          {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add...
Manifest   2.0.0.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest...
Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAcc...
Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Re...
Manifest   2.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Re...
Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disa...
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance,...
Manifest   1.0        ConfigCI                            {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIP...
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Rem...
Manifest   1.0.0.0    DeliveryOptimization                {Get-DeliveryOptimizationStatus, Get-DeliveryOptimizationP...
Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAManualEntry...
Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-Window...
Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get...
Manifest   1.0.0.0    EventTracingManagement              {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceS...
Manifest   2.0.0.0    International                       {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMet...
Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-Iscs...
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-KdsC...
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...
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   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredS...
Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...
Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTrans...
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-Ne...
Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProfile}
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEvent...
Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTea...
Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMa...
Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, ...
Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPse...
Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTea...
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol...
Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Rese...
Manifest   1.0.0.0    NetworkSwitchManager                {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEt...
Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfig...
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restar...
Binary     1.0.0.0    PersistentMemory                    {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegio...
Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-Certificate...
Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, D...
Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-Prin...
Binary     1.0.11     ProcessMitigations                  {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-P...
Script     3.0        Provisioning                        {Install-ProvisioningPackage, Export-ProvisioningPackage, ...
Manifest   1.1        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConfiguration,...
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WS...
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-Jo...
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-ScheduledT...
Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBoo...
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbSha...
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...
Manifest   1.0.0.0    StartLayout                         {Export-StartLayout, Import-StartLayout, Export-StartLayou...
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add...
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disa...
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-Uev...
Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnectio...
Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}
Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperL...
Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsErrorReporti...
Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
Manifest   1.0.0.0    WindowsUpdate                       Get-WindowsUpdateLog
Manifest   1.0.0.2    WindowsUpdateProvider               {Get-WUAVersion, Get-WULastInstallationDate, Get-WULastSca...


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


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.41.51.0  AzureInformationProtection          {Clear-RMSAuthentication, Get-RMSFileStatus, Get-RMSServer...

Environment Data

$PSVersionTable

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

Debug Output

PS C:\users\XX\code\AzureOperations\PowerShell\Subscriptions> set-azurermsecuritycontact -name "default1" -email "user
@domain.com" -phone "1-888-888-8888" -alertadmin -notifyonalert
DEBUG: 11:48:02 AM - SetSecurityContacts begin processing with ParameterSet 'SubscriptionLevelResource'.
DEBUG: 11:48:02 AM - using account id 'XX'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'XX', environment: 'AzureCloud',
tenant: 'fd799da1-bfc1-4234-a91c-72b3a1cb9e26'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/XX/providers/Microsoft.Security/securityCo
ntacts/default1?api-version=2017-08-01-preview

Headers:
x-ms-client-request-id        : 690f349d-b139-48ca-843a-bb63593ff033
accept-language               : en-US

Body:
{
  "properties": {
    "email": "[email protected]",
    "phone": "1-888-888-8888",
    "alertNotifications": "On",
    "alertsToAdmins": "On"
  }
}

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

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-request-id               : f16d2800-d7f3-4fec-a9c2-3b39ef997e7b
x-ms-ratelimit-remaining-subscription-resource-requests: 249
x-ms-correlation-request-id   : d3105782-c67d-4633-860d-c5e48a567717
x-ms-routing-request-id       : SOUTHCENTRALUS:20190214T194803Z:d3105782-c67d-4633-860d-c5e48a567717
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Thu, 14 Feb 2019 19:48:03 GMT
Server                        : Microsoft-HTTPAPI/2.0

Body:
{
  "id": "/subscriptions/XX/providers/Microsoft.Security/securityContacts/default1",
  "name": "default1",
  "type": "Microsoft.Security/securityContacts",
  "properties": {
    "email": "[email protected]",
    "phone": "1-888-888-8888",
    "alertNotifications": "On",
    "alertsToAdmins": "On"
  }
}



Id                 : /subscriptions/XX/providers/Microsoft.Security/securityContacts/
                     default1
Name               : default1
Email              : [email protected]
Phone              : 1-888-888-8888
AlertNotifications : On
AlertsToAdmins     : On

DEBUG: AzureQoSEvent: CommandName - Set-AzSecurityContact; IsSuccess - True; Duration - 00:00:01.2955428; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 11:48:04 AM - SetSecurityContacts end processing.
DEBUG: 11:48:04 AM - SetSecurityContacts end processing.


PS C:\users\XX\code\AzureOperations\PowerShell\Subscriptions> set-azurermsecuritycontact -name "default2" -email "user
[email protected]" -phone "" -alertadmin -notifyonalert
Set-AzSecurityContact : Cannot validate argument on parameter 'Phone'. The argument is null or empty. Provide an
argument that is not null or empty, and then try the command again.
At line:1 char:78
+ ... ycontact -name "default2" -email "[email protected]" -phone "" -alerta ...
+                                                                ~~
    + CategoryInfo          : InvalidData: (:) [Set-AzSecurityContact], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Security.Cmdlets.SecurityConta
   cts.SetSecurityContacts

PS C:\users\XX\code\AzureOperations\PowerShell\Subscriptions> set-azurermsecuritycontact -name "default2" -email "user
[email protected]" -phone "1-888-888-8888" -alertadmin -notifyonalert
DEBUG: 11:48:32 AM - SetSecurityContacts begin processing with ParameterSet 'SubscriptionLevelResource'.
DEBUG: 11:48:32 AM - using account id 'XX'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'XX', environment: 'AzureCloud',
tenant: 'fd799da1-bfc1-4234-a91c-72b3a1cb9e26'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/XX/providers/Microsoft.Security/securityCo
ntacts/default2?api-version=2017-08-01-preview

Headers:
x-ms-client-request-id        : 2f8d4643-3c8e-4dfd-a55e-30ae8ac70ae6
accept-language               : en-US

Body:
{
  "properties": {
    "email": "[email protected]",
    "phone": "1-888-888-8888",
    "alertNotifications": "On",
    "alertsToAdmins": "On"
  }
}

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

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-resource-requests: 248
x-ms-request-id               : 1abdab51-3dbc-449d-9f16-ee7a1abdf0f2
x-ms-correlation-request-id   : 1abdab51-3dbc-449d-9f16-ee7a1abdf0f2
x-ms-routing-request-id       : SOUTHCENTRALUS:20190214T194833Z:1abdab51-3dbc-449d-9f16-ee7a1abdf0f2
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Thu, 14 Feb 2019 19:48:33 GMT
Server                        : Microsoft-HTTPAPI/2.0

Body:
{
  "error": {
    "code": "InvalidInputJson",
    "message": "Invalid JSON was provided - Only first contact is allowed to have a 'Phone' field."
  }
}

set-azurermsecuritycontact : Invalid JSON was provided - Only first contact is allowed to have a 'Phone' field.
At line:1 char:1
+ set-azurermsecuritycontact -name "default2" -email "[email protected]" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzSecurityContact], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Security.Cmdlets.SecurityContacts.SetSecurityContacts

DEBUG: AzureQoSEvent: CommandName - Set-AzSecurityContact; IsSuccess - False; Duration - 00:00:00.6889858; Exception -
Microsoft.Rest.Azure.CloudException: Invalid JSON was provided - Only first contact is allowed to have a 'Phone'
field.
   at Microsoft.Azure.Management.Security.SecurityContactsOperations.<CreateWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Commands.Security.Cmdlets.SecurityContacts.SetSecurityContacts.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 11:48:34 AM - SetSecurityContacts end processing.
DEBUG: 11:48:34 AM - SetSecurityContacts end processing.
PS C:\users\ccey\code\AzureOperations\PowerShell\Subscriptions>

ikiris04 avatar Feb 14 '19 19:02 ikiris04

@chlavah Can you take a look at this issue?

maddieclayton avatar Feb 14 '19 21:02 maddieclayton

Any update? Also the -alertadmin and -notifyonalert are required switches even though you can set them to false in the portal

ikiris04 avatar Apr 18 '19 18:04 ikiris04

Waiting for the update..The last time I ran Set-AzureRmSecurityContact, I could set multiple emails and the Phone was not required.

And I hope these issues can also be fixed at the same time:

  1. Remove-AzureRmSecurityContact only allows to remove the last contact. If I have three contacts "default", "default2", "default3", I can only remove "defalut3". Remove-AzureRmSecurityContact -Name "default2" will have an error.

  2. Is it possible to customize the Name? The mandatory "defaultX" format is not very helpful when trying to get a security contact by Name.

Thanks..

handsomeppz avatar Jan 12 '20 20:01 handsomeppz

Looking for the appropriate team contact for this issue

AddySanto avatar Nov 16 '20 11:11 AddySanto

I hope we get an update on this... the portal doesn't require a number nor does it require -AlertAdmin and -NotifyOnAlert

sarah026 avatar Nov 27 '20 17:11 sarah026

Hi, We resolved the issues raised in this thread - please validate the fix indeed working for you.

Regarding the portal question - our portal page is using a newer API version (documentation for the newer version will be published soon). The -AlertAdmin and -NotifyOnAlert are not required anymore in the newer API version, and the phone-number capability was retired (we never gave any functionality using the phone-number, only the ability to save one - this is the reason it was retired).

Please let me know if I answered your questions or you still have any open questions.

Best, Tal Rosler, Product Manager - Azure Security Center.

tarosler avatar Dec 29 '20 16:12 tarosler