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

Set-AzureRmSqlServerFirewallRule Resource not found for the segment

Open ronbok opened this issue 10 years ago • 7 comments

Set-AzureRmSqlServerFirewallRule -FirewallRuleName $AzureFWRuleName -StartIpAddress $StartIP -EndIpAddress $EndIP -ServerName $($AzureSQLServerNames[$Count]) -ResourceGroupName $($AzureRGNames[$Count])

Returns Set-AzureRmSqlServerFirewallRule : NotFound: Resource not found for the segment 'firewallRules'.

ronbok avatar Mar 25 '16 17:03 ronbok

This results in not being able to create a firewall rule via PS. Even if one is created manually in the UI and you try to execute a Set- it fails.

ronbok avatar Mar 25 '16 19:03 ronbok

@ronbok Apologies for the bad experience. Can you execute the command with $DebugPreference="Continue" and include the logs - this will include messages between client and server, which should help in determining the underlying issue.

markcowl avatar Mar 25 '16 19:03 markcowl

Closing this issue due to a lack of activity since it was opened.

@ronbok please feel free to reopen this issue if you have any other questions.

cormacpayne avatar Mar 04 '17 07:03 cormacpayne

still not working, debug:

DEBUG: 9:55:48 - SetAzureSqlServerFirewallRule begin processing with ParameterSet '__AllParameterSets'. DEBUG: 9:55:48 - using account id 'blah'... DEBUG: [Common.Authentication]: Checking token expiration, token expires '03/19/2019 09:47:51 +00:00' Comparing to '03/19/2019 08:55:48 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:52:02.5172227' DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: GET

Absolute Uri: https://management.azure.com/subscriptions/8b472e31-c1b5-4000-95d6-f518844c6c38/resourceGroups/CC-Test/providers/Microsoft.Sql/servers/qt-cc-jaka-sqlserver/firewallRules/Test?api-version=2014-04-01

Headers:

Body:

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

Status Code: NotFound

Headers: x-ms-request-id : 70432305-f9d3-4d40-aece-59731206598e X-Content-Type-Options : nosniff DataServiceVersion : 3.0; Strict-Transport-Security : max-age=31536000; includeSubDomains x-ms-ratelimit-remaining-subscription-reads: 11999 x-ms-correlation-request-id : eb231ea9-ed6d-41fc-bd29-8f3b8d3e347d x-ms-routing-request-id : WESTEUROPE:20190319T085551Z:eb231ea9-ed6d-41fc-bd29-8f3b8d3e347d Cache-Control : no-store, no-cache Date : Tue, 19 Mar 2019 08:55:51 GMT Server : Microsoft-HTTPAPI/2.0

Body: { "code": "NotFound", "message": "Resource not found for the segment 'firewallRules'.", "target": null, "details": [], "innererror": [] }

Set-AzSqlServerFirewallRule : NotFound: Resource not found for the segment 'firewallRules'. At line:2 char:1

  • Set-AzSqlServerFirewallRule -ResourceGroupName "CC-Test" -ServerName ...
  •   + CategoryInfo          : CloseError: (:) [Set-AzSqlServerFirewallRule], CloudException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.FirewallRule.Cmdlet.SetAzureSqlServerFirewallRule
    
    

DEBUG: AzureQoSEvent: CommandName - Set-AzSqlServerFirewallRule; IsSuccess - False; Duration - 00:00:00.5862630; Exception - Hyak.Common.CloudException: NotFound: Resource not found for the segment 'firewallRules'. at Microsoft.Azure.Management.Sql.LegacySdk.FirewallRuleOperations.d__6.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.Management.Sql.LegacySdk.FirewallRuleOperationsExtensions.Get(IFirewallRuleOperations operations, String resourceGroupName, String serverName, String firewallRule) at Microsoft.Azure.Commands.Sql.FirewallRule.Services.AzureSqlServerFirewallRuleCommunicator.Get(String resourceGroupName, String serverName, String firewallRuleName) at Microsoft.Azure.Commands.Sql.FirewallRule.Adapter.AzureSqlServerFirewallRuleAdapter.GetFirewallRule(String resourceGroupName, String serverName, String firewallRuleName) at Microsoft.Azure.Commands.Sql.FirewallRule.Cmdlet.SetAzureSqlServerFirewallRule.GetEntity() at Microsoft.Azure.Commands.Sql.Common.AzureSqlCmdletBase`2.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord(); DEBUG: Finish sending metric. DEBUG: 9:55:50 - SetAzureSqlServerFirewallRule end processing. DEBUG: 9:55:50 - SetAzureSqlServerFirewallRule end processing.

kapolb avatar Mar 19 '19 09:03 kapolb

@ronbok, @kapolb try to use New-AzSqlServerFirewallRule for creating a new rule and Set-AzSqlServerFirewallRule for updating an existing one.

asmagin avatar Jul 21 '19 16:07 asmagin

Set-AzSqlServerFirewallRule: NotFound: Resource not found for the segment 'firewallRules'.

This message cryptically tells us that the named firewall rule cannot be found.

golfalot avatar Dec 16 '20 10:12 golfalot

Has there been any update on this ticket?

masoudmodabber avatar Oct 01 '24 23:10 masoudmodabber