-
Notifications
You must be signed in to change notification settings - Fork 467
/
AzureApplicationInsightsResource.cs
30 lines (25 loc) · 1.34 KB
/
AzureApplicationInsightsResource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Aspire.Hosting.ApplicationModel;
namespace Aspire.Hosting.Azure;
/// <summary>
/// A resource that represents an Azure Application Insights resource.
/// </summary>
/// <param name="name">The resource name.</param>
/// <param name="configureConstruct">Callback to configure the Azure Application Insights resource.</param>
public class AzureApplicationInsightsResource(string name, Action<ResourceModuleConstruct> configureConstruct) :
AzureConstructResource(name, configureConstruct),
IResourceWithConnectionString
{
/// <summary>
/// Gets the "appInsightsConnectionString" output reference for the Azure Application Insights resource.
/// </summary>
public BicepOutputReference ConnectionString => new("appInsightsConnectionString", this);
/// <summary>
/// Gets the connection string template for the manifest for the Azure Application Insights resource.
/// </summary>
public ReferenceExpression ConnectionStringExpression =>
ReferenceExpression.Create($"{ConnectionString}");
// UseAzureMonitor is looks for this specific environment variable name.
string IResourceWithConnectionString.ConnectionStringEnvironmentVariable => "APPLICATIONINSIGHTS_CONNECTION_STRING";
}