Get an empty list of firewallRules when querying a postgres instance through a AzureFunction
See original GitHub issue- Package Name: @azure/arm-postgresql
- Package Version: 6.0.0
- Operating system: MacOS
- nodejs
- version: v14.18.3
- browser
- name/version:
- typescript
- version: 4.4.2
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug I’m trying to get the list of firewall rules on a Postgres Instance in Azure, using the azure-js-sdk. Locally it works like a charm, I’ve got the list of firewall rules from my selected postgres instance. When I launch this process in an Azure function, targetting the same postgres instance, the firewall rules list is always empty, and there is no error message or exception thrown.
To Reproduce Steps to reproduce the behavior: Code which work locally
...
const azureCredential = new DefaultAzureCredential();
const subscriptionClient = new SubscriptionClient(azureCredential);
const postgresCli = new PostgreSQLManagementClient(azureCredential, 'mySubscriptionId');
const fwRules = postgresCli.firewallRules.listByServer('myResourceGroup', 'myServerName');
for await (const fwRule of fwRules) {
context.log.info('in the for of fwRules');
context.log.info('DELETING ', fwRule.name, ' in ', azResourceGroup);
...
}
Code which return a empty firewall rules list in a Azure function
index.ts
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise~void~ {
try {
const azureCredential = new DefaultAzureCredential();
const subscriptionClient = new SubscriptionClient(azureCredential);
const postgresCli = new PostgreSQLManagementClient(azureCredential, 'mySubscriptionId');
const fwRules = postgresCli.firewallRules.listByServer('myResourceGroup', 'myServerName');
for await (const fwRule of fwRules) {
context.log.info('in the for of fwRules');
context.log.info('DELETING ', fwRule.name, ' in ', azResourceGroup);
...
}
}
catch (e) {
context.log.error(e);
context.res = { status: 500, body: 'Internal Server Error' };
}
};
function.json
'bindings': [
{
'authLevel': 'function',
'type': 'httpTrigger',
'direction': 'in',
'name': 'req',
'methods': [
'get'
]
},
{
'type': 'http',
'direction': 'out',
'name': 'res'
}
],
'scriptFile': '../target/foobar/index.js'
Expected behavior I expect to get the same list of firewall rules when i run my program locally or in an azure function.
Screenshots N/A
Additional context N/A
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Get the list of firewall rules on a Postgres Instance in Azure ...
You can try another approach to connect with Azure PostgreSQL DB from Azure Function App and try to get the firewall rules adterwords....
Read more >az postgres server firewall-rule create - Microsoft Learn
List all firewall rules for a server. ... Get the details of a firewall rule. ... You can configure the default group using...
Read more >Ensure Postgres RDS has Query Logging enabled
This check ensures that you have enabled query logging set up for your PostgreSQL database instance. An instance needs to have a non-default...
Read more >Serverless relational code first database apps in Azure - Medium
Search for Azure PostgreSQL in the Azure Marketplace to create a new database server. Make sure to pick the offer by Microsoft with...
Read more >runzero-manual.pdf
The runZero Explorer can be run in an AWS EC2 instance. However, there are a number of ... on where you obtain your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for reporting this, I will take a look.
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!