Azure App service restrictions not working - azure

I have the following setup on azure:
1 app service for .NET backend
1 app service for angular frontend with a custom domain
1 SQL server
I created a virtual network, I added 2 subnets for frontend and backend.I assigned these subnets to application services.
I would like to allow only the frontend to access my backend but my frontend receives 403 from my backend.
I created Access Restrictions that allow only inbound connection from the subnet, or IP but my frontend receives 403 when is trying to access it. What could be the problem?

As you are getting 403 which implies forbidden, so looked like an access issue here.
As per the official documentation, you may need to provide permissions as well to the subnet or at a higher level.

Related

Azure Application Gateway: Why when i hit its Public IP, i redirect to "<app_service_url>:80"?

I have an app service which runs web app.
I created application gateway on the front of wab app.
But when i hit Application Gatway's Public IP, i get redirected to https://somename.azurewebsites.net:80/
My Questions
Why it does not goes to go <ApplicationGatwayPublicIP> directly instead of https://somename.azurewebsites.net:80/
Let's assume that i accepte to https://somename.azurewebsites.net:80/. Why it adds 80 at the end (which i have to delete manually in oreder to work)?
Thank you in advance for your help!
PS: I will make some screenshot which can be helpul:
Backend Pool (app service):
Backend Settings (for app service):
If you need more informations, please make me a comment
Thank you again
To resolve this issue, you need configure your backend pool with use of custom domain as below:
Make sure to add authentication/trusted root certificates of back-end servers and upload a certificate as below:
And configure a request to routing rule in setting under rules in backend targets try to add the Backend Pool which App Service has been configured and HTTP setting add which app gateway to connect app service and save
Once a backend pool is healthy stage now you can able to use public IP addresses that can be accessed directly. Now you can try to restrict access. check this similar issue answer by jeremy
The main cause of issue you need to add custom domain Configure App Service with Application Gateway along with certificate.
Reference:
Manage traffic to App Service - Azure Application Gateway | Microsoft Learn

Access restriction for app service holding ocelote api gateway project

I have deployed few .net core microservices along with ocelot api gateway and react application using azure app services.
Every app service is running in its own app service plan and subnet with vnet integration enabled. I am able to restrict direct access to microservices through service end points.
The problem is, I want to restrict access to api gateway app service so that it only accepts traffic from react application app service. Whenever I try to do so through vnet integration and service endpoints, my application stops working with 403 IP forbidden.
Is there any way I can achieve the desired result?

Google cloud run give me 403 since other app of the same project

I have the frontend and backend on cloud run, each whit his own service, but when I put "internal traffic" on the backend API, It doesn't work, give me 403 since the frontend and it is another service of the same project, and in the documentation says that internal means "only for the same project" so...
two services since the same project are not internal traffic?
I think that is because I use a custom domain and not the exact URL of the service but I am not sure because here says that the custom domains are allowed too.
So what do I have to do to auth my frontend service on cloud run?
I tried whit JWT auth, but there is a better option, isn't it
Cloud Run services set to internal only accepts traffic coming from the VPC network. In order to connect to a Cloud Run service that's serving internal traffic, the connecting service must be attached to a VPC connector. In this case, you need to setup Serverless VPC access connector as mentioned in this note:
For requests from other Cloud Run services or from Cloud Functions in the same project, connect the service or function to a VPC network and route all egress through the connector, as described in Connecting to a VPC network. Note that the IAM invoker permission is still enforced.
For authenticating between service-to-service, you can simply fetch an ID token from the Compute medatada server. You can do that on any GCP compute environment (Cloud Run, App Engine, Compute Engine, etc.). You can follow the steps provided in this documentation.
two services since the same project are not internal traffic?
Two services in the same project should be considered as internal traffic.
I believe what you need to do is follow the authentication steps with token as recommended here (service to service authentication):
https://cloud.google.com/run/docs/authenticating/service-to-service
https://cloud.google.com/run/docs/securing/service-identity#per-service-identity
Please note that even though you've set the ingress traffic to internal, the IAM role cloud run invoker is still needed for the service account.

Azure web app access restrictions to application gateway

I am using a V1 WAF application gateway (dynamic IP) in front of a web app.
When i configure the web app access restrictions to Allow the application gateway i received a when i tryu to access the web app url (expected behavior). However, i also received a 403 when accessing throught the app gateway url (not expected !). i have try a rule to allow the app gateway ip and also a rule allowing the app gateway vnet (service endpoint) with both same result. Any idea why its not working ? Thx!
I suggest you to know about this topic. you are probably getting a VPC error.
https://azure.microsoft.com/en-us/services/virtual-network/#overview

Azure app service - how do I whitelist an endpoint (not IP address)

I have Azure app service (Web API) and have restricted access to everyone and allowed access by Ipaddress using access restrictions (https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions)
I want to allow a particular domain/endpoint access to the API doesn't matter which IP address they are coming from. Is there any way possible to do it.
Unfortunately, It's impossible to whitelist a particular domain/endpoint to the Azure app service using access restrictions as essentially the domain name will be resolved to a real IP address via DNS when the client access the web API in the Azure app service.
Not sure why you want to only allow a particular domain. Perhaps, you just want to map a custom domain to Azure App Service. Then you can access the web API using your multiple custom domain URLs.
Furthermore, optionally, you could apply an Application gateway in front of your web API, then you could access your backend web API using a custom domain URL or Application gateway URL. Application Gateway can make routing decisions based on additional attributes of an HTTP request, for example, URI path or host headers. Also, you could whitelist the Application gateway frontends in your app service access restrictions. See Configure App Service with Application Gateway for more details.
I hope it's helpful for you.

Resources