How to define the cloud role name from a PowerShell script?

Angers Hugo 0 Reputation points

I am using Application Insights to log events and exceptions that occur in a PowerShell script.
I need to define the cloud role name so a new node would be added in the application map..
I tried this but it doesn't work:

$appInsights.InstrumentationKey = $ConfigEnvironement.Settings.AppInsightsInstrumentationKey;
$appInsights.Context.Cloud.RoleInstance = "";
$appInsights.Context.Cloud.RoleName = "roleName";

There is no new node in the application map. Do I need to add a telemetry initializer like below?:

$appInsights.TelemetryConfiguration.TelemetryInitializers.Add(What to add here?);

I can't find any source of information regarding the cloud role name in PowerShell...

Thanks for your help!

A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,852 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    Comments have been turned off. Learn more