ApiKey
Manages an Application Insights API key.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleInsights = new Azure.AppInsights.Insights("exampleInsights", new Azure.AppInsights.InsightsArgs
{
Location = "West Europe",
ResourceGroupName = exampleResourceGroup.Name,
ApplicationType = "web",
});
var readTelemetry = new Azure.AppInsights.ApiKey("readTelemetry", new Azure.AppInsights.ApiKeyArgs
{
ApplicationInsightsId = exampleInsights.Id,
ReadPermissions =
{
"aggregate",
"api",
"draft",
"extendqueries",
"search",
},
});
var writeAnnotations = new Azure.AppInsights.ApiKey("writeAnnotations", new Azure.AppInsights.ApiKeyArgs
{
ApplicationInsightsId = exampleInsights.Id,
WritePermissions =
{
"annotations",
},
});
var authenticateSdkControlChannelApiKey = new Azure.AppInsights.ApiKey("authenticateSdkControlChannelApiKey", new Azure.AppInsights.ApiKeyArgs
{
ApplicationInsightsId = exampleInsights.Id,
ReadPermissions =
{
"agentconfig",
},
});
var fullPermissions = new Azure.AppInsights.ApiKey("fullPermissions", new Azure.AppInsights.ApiKeyArgs
{
ApplicationInsightsId = exampleInsights.Id,
ReadPermissions =
{
"agentconfig",
"aggregate",
"api",
"draft",
"extendqueries",
"search",
},
WritePermissions =
{
"annotations",
},
});
this.ReadTelemetryApiKey = readTelemetry.ApiKey;
this.WriteAnnotationsApiKey = writeAnnotations.ApiKey;
this.AuthenticateSdkControlChannel = authenticateSdkControlChannelApiKey.ApiKey;
this.FullPermissionsApiKey = fullPermissions.ApiKey;
}
[Output("readTelemetryApiKey")]
public Output<string> ReadTelemetryApiKey { get; set; }
[Output("writeAnnotationsApiKey")]
public Output<string> WriteAnnotationsApiKey { get; set; }
[Output("authenticateSdkControlChannel")]
public Output<string> AuthenticateSdkControlChannel { get; set; }
[Output("fullPermissionsApiKey")]
public Output<string> FullPermissionsApiKey { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/appinsights"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleInsights, err := appinsights.NewInsights(ctx, "exampleInsights", &appinsights.InsightsArgs{
Location: pulumi.String("West Europe"),
ResourceGroupName: exampleResourceGroup.Name,
ApplicationType: pulumi.String("web"),
})
if err != nil {
return err
}
readTelemetry, err := appinsights.NewApiKey(ctx, "readTelemetry", &appinsights.ApiKeyArgs{
ApplicationInsightsId: exampleInsights.ID(),
ReadPermissions: pulumi.StringArray{
pulumi.String("aggregate"),
pulumi.String("api"),
pulumi.String("draft"),
pulumi.String("extendqueries"),
pulumi.String("search"),
},
})
if err != nil {
return err
}
writeAnnotations, err := appinsights.NewApiKey(ctx, "writeAnnotations", &appinsights.ApiKeyArgs{
ApplicationInsightsId: exampleInsights.ID(),
WritePermissions: pulumi.StringArray{
pulumi.String("annotations"),
},
})
if err != nil {
return err
}
authenticateSdkControlChannelApiKey, err := appinsights.NewApiKey(ctx, "authenticateSdkControlChannelApiKey", &appinsights.ApiKeyArgs{
ApplicationInsightsId: exampleInsights.ID(),
ReadPermissions: pulumi.StringArray{
pulumi.String("agentconfig"),
},
})
if err != nil {
return err
}
fullPermissions, err := appinsights.NewApiKey(ctx, "fullPermissions", &appinsights.ApiKeyArgs{
ApplicationInsightsId: exampleInsights.ID(),
ReadPermissions: pulumi.StringArray{
pulumi.String("agentconfig"),
pulumi.String("aggregate"),
pulumi.String("api"),
pulumi.String("draft"),
pulumi.String("extendqueries"),
pulumi.String("search"),
},
WritePermissions: pulumi.StringArray{
pulumi.String("annotations"),
},
})
if err != nil {
return err
}
ctx.Export("readTelemetryApiKey", readTelemetry.ApiKey)
ctx.Export("writeAnnotationsApiKey", writeAnnotations.ApiKey)
ctx.Export("authenticateSdkControlChannel", authenticateSdkControlChannelApiKey.ApiKey)
ctx.Export("fullPermissionsApiKey", fullPermissions.ApiKey)
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_insights = azure.appinsights.Insights("exampleInsights",
location="West Europe",
resource_group_name=example_resource_group.name,
application_type="web")
read_telemetry = azure.appinsights.ApiKey("readTelemetry",
application_insights_id=example_insights.id,
read_permissions=[
"aggregate",
"api",
"draft",
"extendqueries",
"search",
])
write_annotations = azure.appinsights.ApiKey("writeAnnotations",
application_insights_id=example_insights.id,
write_permissions=["annotations"])
authenticate_sdk_control_channel_api_key = azure.appinsights.ApiKey("authenticateSdkControlChannelApiKey",
application_insights_id=example_insights.id,
read_permissions=["agentconfig"])
full_permissions = azure.appinsights.ApiKey("fullPermissions",
application_insights_id=example_insights.id,
read_permissions=[
"agentconfig",
"aggregate",
"api",
"draft",
"extendqueries",
"search",
],
write_permissions=["annotations"])
pulumi.export("readTelemetryApiKey", read_telemetry.api_key)
pulumi.export("writeAnnotationsApiKey", write_annotations.api_key)
pulumi.export("authenticateSdkControlChannel", authenticate_sdk_control_channel_api_key.api_key)
pulumi.export("fullPermissionsApiKey", full_permissions.api_key)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleInsights = new azure.appinsights.Insights("exampleInsights", {
location: "West Europe",
resourceGroupName: exampleResourceGroup.name,
applicationType: "web",
});
const readTelemetry = new azure.appinsights.ApiKey("readTelemetry", {
applicationInsightsId: exampleInsights.id,
readPermissions: [
"aggregate",
"api",
"draft",
"extendqueries",
"search",
],
});
const writeAnnotations = new azure.appinsights.ApiKey("writeAnnotations", {
applicationInsightsId: exampleInsights.id,
writePermissions: ["annotations"],
});
const authenticateSdkControlChannelApiKey = new azure.appinsights.ApiKey("authenticateSdkControlChannelApiKey", {
applicationInsightsId: exampleInsights.id,
readPermissions: ["agentconfig"],
});
const fullPermissions = new azure.appinsights.ApiKey("fullPermissions", {
applicationInsightsId: exampleInsights.id,
readPermissions: [
"agentconfig",
"aggregate",
"api",
"draft",
"extendqueries",
"search",
],
writePermissions: ["annotations"],
});
export const readTelemetryApiKey = readTelemetry.apiKey;
export const writeAnnotationsApiKey = writeAnnotations.apiKey;
export const authenticateSdkControlChannel = authenticateSdkControlChannelApiKey.apiKey;
export const fullPermissionsApiKey = fullPermissions.apiKey;Create a ApiKey Resource
new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);def ApiKey(resource_name, opts=None, application_insights_id=None, name=None, read_permissions=None, write_permissions=None, __props__=None);func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
ApiKey Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The ApiKey resource accepts the following input properties:
- Application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- Read
Permissions List<string> Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- Write
Permissions List<string> Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- Application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- Read
Permissions []string Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- Write
Permissions []string Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- read
Permissions string[] Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- write
Permissions string[] Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- application_
insights_ strid The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- name str
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- read_
permissions List[str] Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- write_
permissions List[str] Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:
Look up an Existing ApiKey Resource
Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ApiKeyState, opts?: CustomResourceOptions): ApiKeystatic get(resource_name, id, opts=None, api_key=None, application_insights_id=None, name=None, read_permissions=None, write_permissions=None, __props__=None);func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- Key string
The API Key secret (Sensitive).
- Name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- Read
Permissions List<string> Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- Write
Permissions List<string> Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- Api
Key string The API Key secret (Sensitive).
- Application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- Read
Permissions []string Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- Write
Permissions []string Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- api
Key string The API Key secret (Sensitive).
- application
Insights stringId The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- name string
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- read
Permissions string[] Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- write
Permissions string[] Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
- api_
key str The API Key secret (Sensitive).
- application_
insights_ strid The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
- name str
Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
- read_
permissions List[str] Specifies the list of read permissions granted to the API key. Valid values are
agentconfig,aggregate,api,draft,extendqueries,search. Please note these values are case sensitive. Changing this forces a new resource to be created.- write_
permissions List[str] Specifies the list of write permissions granted to the API key. Valid values are
annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.