Connect from Azure to an on-premise fileshare - azure

From an Azure Function I need to read files on an on-premise Windows file-share. I have network access to the file server but how do I authenticate?
My Azure Function is running in an Isolated App Service Environment in Azure connected to a VNet that is peered to the on-premise corporate network though an express route.
Side note: I will get the same issue with Azure Functions running on Azure Stack Hub, but I guess the solution will be the same.

Related

Azure Logic App - Access SQL Server running in Azure VM

My client has a SQL Server instance installed on an Azure VM.
I am building an Azure Logic App and the end result is to write to this SQL Server instance.
To connect to this SQL Server instance running on the Azure VM do I need to treat it the same way I would as an on-prem SQL Server and install the gateway softwaare, or is there a better way since the VM is in Azure?
You shouldn't need to use a gateway. A gateway is mainly used for securing the data connection from a cloud service to an on-prem datbase, since the traffic goes over the public internet.
With the DB on an Azure VM, you can deploy your logic app into an integrated service environment. This keeps the traffic between logic app and DB on the private VNET. See the documentation on ISEs here.

Accessing service on a Virtual Machine from azure app service

We have got VMs on Azure and services are running in there.
We are trying to deploy our MVC Web application to Azure App service, which accesses some of the services from the VM using the private IPs but it can't connect to the service hosted on the VM using the private IP. We were assuming that all of our resources will be in the same network, can anyone help with this?
Thanks
Azure App service are having two kinds of hostings
Single Tenant (App Service Environment) which is dedicated to the customer
Multi tenant ( shareable across other customer subscription inside a data center scale unit)
If your application is hosted as multi tenant application meaning app service URL {WEbAppName}.Azurewebsites.net then its internet facing application and if it needs to connect to any VNET (Virtual Network) hosted service then it needs to integrate to any or same VNET.
How to do App service VNET Integration:
https://learn.microsoft.com/en-us/azure/app-service/overview-vnet-integration#regional-virtual-network-integration
Once the App service integrated with VNET then ideally it has connectivity with all the services present inside the same VNET or with peered VNET.
How to confirm connectivity from App Service to VNET hosted resource.
Go to App Services application => Advanced tools or console => perform below commands sequence wise as the HTTP communication happens through this sequence:
nslookup {Destination_FQDN} {Optional-DNSServer}/nameresolver {Destination_FQDN} {Optional-DNSServer}
tcpping {Destination FQDN}
curl -v {DestinationFQDN}
Common Scenarios:
If you're receiving connection refused it means its NSG is not allowing the communication.
If you're getting request time out it means it could be due to firewall or no proper routes to reach to destination.
If its connection abort it means its intermediate device is not passing connection through.
Troubleshoot connectivity issues using Azure Network Watcher: https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-connectivity-portal

Hosting web api as webapp in azure along with VM in same data center

I have a VM running SQL Server in Azure East US2. I also hosted a webapi as azure web app. Connection string used in webapi is being routed through internet gateway right now. I want to ensure that both of these services are hosted on same data center so that they communicate over LAN instead of internet gateway.
I was trying to setup a VNET and when I tried adding this VNET to webapi, it asks to setup VPN gateway. Why do I need to setup VPN gateway, are they not aware of being on same data center. Can't they be put on LAN without setting up VPN.
When you deploy both your VM and your Web App in Azure East US2 they land on the same geo-region. Please note that a lot of Azure Regions do have more than one facility (the thing you call Data Center), and you have no control over where exactly within a region (i.e. East US2) your resource will be deployed.
Now, if you want to talk to your SQL Server on an Azure VM from the Web App, you have to use VNet integraton. Because you are not deploying into a App Service Environment, you have to connect your web app to the VNet where your SQL Server is. The way to do this is by implicitly utilising a Point-to-Site VPN Connection between your web app and your VNet.
Do not worry, the whole process is automated and you do not have to deal with certificates and certificate roll-over, but there is a need for VPN Gateway. That's way you are being asked for the VPN Gateway.
But you should really consider using Azure SQL DB instead an SQL Server on VM.

Can I use Azure Functions within ExpressRoute?

I have an Azure function under an ExpressRoute subscription that is trying to connect to an on-prem database, but fails to do so.
Is it possible to use Azure functions within ExpressRoute?
Thanks!
An Azure Function can be deployed on an App Service Environment. The App Service Environment is deployed on your own VNET which can have access to on-prem resources via ExpressRoute.
If you don't want to pay for an App Service Environment, you can deploy your Function on a dedicated App Service Plan and then use Hybrid Connections to connect to on-prem, or integrate the Function App to your VNET and create a Site-to-Site VPN to on-premises. These last 2 options option, however, won't go through ExpressRoute.
All 3 options are described here. You just need to deploy your Azure Function to an App Service Plan to get same features as an App Service.
HTH
Not without setting up a dedicated router virtual appliance (e.g. a CiscoASA VM from the Azure marketplace). Microsoft will say "not supported", but we were able to get it working in this manner.

Connecting to an on-premises SQL database from Azure WebJob

How do I connect to a database on-premises from an Azure WebJob or an Azure Function? Is this even possible?
I've been recently researching this and have found there a 3 avenues to connect app services to on prem database, as of today anyway.
Hybrid Connection, VNET Integration or App Service Environment
The later 2 options require VPN or Express (I think) connectivity to a cloud VNET. The VNET Integration option requires a separate VNET with PointToSite gateway connecting to your existing VNET. The App Service Environment is a quite expensive option as your App Service Plan is actually hosted inside your VNET, no longer being a shared host.

Resources