Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.22k stars 3.83k forks source link

Get-AzPostgreSqlReplica this ps command only works for single server not for flexible server. #23879

Closed crprashant closed 1 month ago

crprashant commented 9 months ago

Type of issue

Other (describe below)

Feedback

Get-AzPostgreSqlReplica this ps command only works for single server not for flexible server.

If flexible server is used, getting error

Get-AzPostgreSqlReplica -ResourceGroupName servers -ServerName testflexibleserver -SubscriptionId Get-AzPostgreSqlReplica : The Resource 'Microsoft.DBforPostgreSQL/servers/testflexibleserver' under resource group 'servers' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix At line:1 char:1

If single server is used, no error

Page URL

https://learn.microsoft.com/en-us/powershell/module/az.postgresql/get-azpostgresqlreplica?view=azps-11.1.0

Content source URL

https://github.com/Azure/azure-powershell/blob/main/src/PostgreSql/PostgreSql/help/Get-AzPostgreSqlReplica.md

Author

@mikefrobbins

Document Id

b0e480bb-27e8-18d0-2a27-0c15cb3ef288

nachoalonsoportillo commented 3 months ago

@crprashant Thanks for reporting this issue! This is expected. Azure Database for Flexible Server primary servers are queried using Get-AzPostgreSqlFlexibleServer. And we should provide another cmdlet through which we would target the API that lists replicas of a given Flexible Server: https://learn.microsoft.com/en-us/rest/api/postgresql/flexibleserver/replicas/list-by-server

kabharati commented 2 months ago

@crprashant - PS cmdlet doesn't exist for flexible server I will add it as a backlog item and see if we can prioritize this ask in the future semester but for now you can use CLI/APIs

kabharati commented 2 months ago

please-close

nachoalonsoportillo commented 1 month ago

@crprashant While this functionality is not made available through cmdlets in the Az.PostgreSql module, please leverage Invoke-AzRestMethod to hit the Server endpoint of any of the versions of the REST API that lists the information about replicas. For example, you can use 2022-12-01.