This message was deleted.
# azure
s
This message was deleted.
b
hi @adorable-airport-36662 would you be able to share the code you're using to create the key?
a
Hi @billowy-army-68599 this is the ts code i used
Copy code
const appInsights = new azure.appinsights.Insights(
    componentName,
    {
        resourceGroupName: resourceGroupName,
        location: location,
        name: componentName,
        applicationType: "web"
    },
    { parent: resourceGroup });

const appInsightsApiKey = new azure.appinsights.ApiKey(
    componentName, {
        name: componentName,
        applicationInsightsId: appInsights.id,
        readPermissions: ["aggregate", "api", "draft", "extendqueries", "search"],
    },
    { parent: appInsights });
Hi @billowy-army-68599 i've able to hackily solve this
create-replacement
issue by replacing the casing in the
appInsightsId
like below. But it feels hacky. Do you have any idea why this is working or have any other approach in mind? thanks!
Copy code
const appInsightsApiKey = appInsights.id.apply(id => new azure.appinsights.ApiKey(
    componentName, {
        name: componentName,
        applicationInsightsId: id.replace(/microsoft.insights/g, "Microsoft.Insights"),
        readPermissions: ["aggregate", "api", "draft", "extendqueries", "search"],
    },
    { parent: appInsights }));