Resource Not Found when querying Azure using PowerShell

Taranjeet Malik 571 Reputation points
2024-02-08T06:30:07.93+00:00

Hi there I'm trying to query for the available Databases (Get-AzSqlDatabase) on an Azure SQL Server and getting the following error: Get-AzSqlDatabase : The Resource 'Microsoft.Sql/servers/ServerName.database.windows.net/databases/DatabaseName' under resource group 'PEMSBIDEVResourceGroup' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix At line:1 char:1 Get-AzSqlDatabase -ServerName "ServerName.database.windows.net ... CategoryInfo : CloseError: (:) [Get-AzSqlDatabase], CloudException FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.Database.Cmdlet.GetAzureSqlDatabase Have looked at this already, but luck - https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-not-found?tabs=bicep Any ideas / suggestions please? Thanks Taranjeet Singh

Azure SQL Database
Windows for business Windows Server User experience PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2024-02-08T08:02:29.1+00:00

    Hi
    Taranjeet Malik
    ,

    Welcome to Microsoft Q&A forum.

    As I understand, you are unable to get details of Azure SQL Database by using Powershell commands.

    From the error it looks like Database does not exist inside the server which is mentioned in the command.

    Kindly check if the Powershell command syntax is correct with all parameters named.

    Also, refer to https://learn.microsoft.com/en-us/powershell/module/az.sql/get-azsqldatabase?view=azps-11.2.0 which has different commandlets which illustrates ways of getting DB details.

    Example:

    Get-AzSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database02"

    Please share sample Powershell command in use if above does not help.

    Thanks

    1 person found this answer helpful.
    0 comments No comments

  2. SSingh-MSFT 16,371 Reputation points Moderator
    2024-02-09T04:08:26.46+00:00

    Hi
    Taranjeet Malik
    ,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Solution: Server short name fixed the issue.

    Example: Server Name: demoserver-sqldbserver.database.windows.net Use: demoserver

    If you have any other questions or are still running into more issues, please let me know.
    Thank you again for your time and patience throughout this issue. Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.