I am getting the following error and I don't know what this error is all about. Which file it is looking for?
The code I want to run in Azure functions is run.csx
#r "/home/.nuget/microsoft.azure.management.containerinstance.fluent/1.16.1/lib/netstandard1.4/Microsoft.Azure.Management.ContainerInstance.Fluent.dll"
#r "/home/.nuget/microsoft.azure.management.fluent/1.14.0/lib/netstandard1.4/Microsoft.Azure.Management.Fluent.dll"
#r "/home/.nuget/microsoft.azure.management.resourcemanager.fluent/1.16.1/lib/netstandard1.4/Microsoft.Azure.Management.ResourceManager.Fluent.dll"
using System;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ContainerInstance.Fluent;
public static IAzure GetAzureContext(string authFilePath, ILogger log)
{
IAzure azure;
ISubscription sub;
try
{
azure = Azure.Authenticate(authFilePath).WithDefaultSubscription();
sub = azure.GetCurrentSubscription();
//log.LogInformation($"Authenticated with subscription '{sub.DisplayName}' (ID: {sub.SubscriptionId})");
}
catch (Exception ex)
{
log.LogInformation($"\nFailed to authenticate:\n{ex.Message}");
if (String.IsNullOrEmpty(authFilePath))
{
log.LogInformation("Have you set the AZURE_AUTH_LOCATION environment variable?");
}
throw;
}
return azure;
}
public static void Run(string myEventHubMessage, ILogger log)
{
// Authenticate with Azure
string authFilePath = "/home/site/wwwroot/EventHubTriggerCSharp3/my.azureauth";
IAzure azure = GetAzureContext(authFilePath, log);
log.LogInformation($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
}
and Dependency file is function.proj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance.Fluent" Version="1.16.1" />
</ItemGroup>
</Project>
Bit if I comment the line where I call GetAzureContext function in void Run, It runs successfully.