Reputation: 71
I am trying to read files from a shared path In Azure VM using azure functions app.
let networkDrive = require('windows-network-drive');
module.exports = function (context, myTimer) {
context.log('start with');
networkDrive.mount("\\\\<IP Address>\\path","Y",'username','password')
.then(function(drive){
context.log("success");
context.log(drive);
})
.catch(function(error){
context.log(error);
})
};
But I am getting Access is Denied. However if I try the same code from console of the Azure VM it is working as expected. Are there any config changes/settings to be changed in functions app/Azure VM to make this work. Any pointers on this is appreciated.
Upvotes: 0
Views: 2009
Reputation: 3332
If it does not time out but denying access it seems your network share is already opened on a public IP. This can be dangerous for brute force attacks and you need some authentication.
The function app's user / service account is currently obviously unknown to your VM. You can
connect both function app and your VM to a Azure AD, so you can use a common security principal to secure and access your share
move you shared data to Azure Storage File service. This works fine without AD and you simply use an access token in your function app.
connect both VM and function app to a single private VNET and find a solution with anonymous access or a security principal.
I'd recommend the 2nd solution.
Upvotes: 1