Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/createFunctionApp/FunctionAppCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi

if (context.appInsightsComponent) {
appSettings.push({
name: 'APPINSIGHTS_INSTRUMENTATIONKEY',
value: context.appInsightsComponent.instrumentationKey
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING',
value: context.appInsightsComponent.connectionString
});

if (isElasticPremium && context.newSiteStack?.stack.value === 'java') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<I
},
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING',
value: `InstrumentationKey=${context.appInsightsComponent?.instrumentationKey}`
value: context.appInsightsComponent?.connectionString
},
{
name: 'FUNCTIONS_EXTENSION_VERSION',
Expand Down
5 changes: 3 additions & 2 deletions src/commands/logstream/startStreamingLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ export async function startStreamingLogs(context: IActionContext, treeItem?: Slo
async function openLiveMetricsStream(context: IActionContext, site: ParsedSite, node: AzExtTreeItem): Promise<void> {
const client = await site.createClient(context);
const appSettings: StringDictionary = await client.listApplicationSettings();
const aiKey: string | undefined = appSettings.properties && appSettings.properties.APPINSIGHTS_INSTRUMENTATIONKEY;
const aiKey: string | undefined = appSettings.properties &&
(appSettings.properties.APPLICATIONINSIGHTS_CONNECTION_STRING || appSettings.properties.APPINSIGHTS_INSTRUMENTATIONKEY);
if (!aiKey) {
// https://github.com/microsoft/vscode-azurefunctions/issues/1432
throw new Error(localize('mustConfigureAI', 'You must configure Application Insights to stream logs on Linux Function Apps.'));
} else {
const aiClient: ApplicationInsightsManagementClient = await createAppInsightsClient([context, node.subscription]);
const components = await uiUtils.listAllIterator(aiClient.components.list());
const component: ApplicationInsightsComponent | undefined = components.find(c => c.instrumentationKey === aiKey);
const component: ApplicationInsightsComponent | undefined = components.find(c => c.connectionString === aiKey || c.instrumentationKey === aiKey);
if (!component) {
throw new Error(localize('failedToFindAI', 'Failed to find application insights component.'));
} else {
Expand Down
Loading