azure.monitoring.LogProfile
Manages a Log Profile. A Log Profile configures how Activity Logs are exported.
NOTE: It’s only possible to configure one Log Profile per Subscription. If you are trying to create more than one Log Profile, an error with
StatusCode=409
will occur.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var exampleAccount = new Azure.Storage.Account("exampleAccount", new()
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
AccountTier = "Standard",
AccountReplicationType = "GRS",
});
var exampleEventHubNamespace = new Azure.EventHub.EventHubNamespace("exampleEventHubNamespace", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
Sku = "Standard",
Capacity = 2,
});
var exampleLogProfile = new Azure.Monitoring.LogProfile("exampleLogProfile", new()
{
Categories = new[]
{
"Action",
"Delete",
"Write",
},
Locations = new[]
{
"westus",
"global",
},
ServicebusRuleId = exampleEventHubNamespace.Id.Apply(id => $"{id}/authorizationrules/RootManageSharedAccessKey"),
StorageAccountId = exampleAccount.Id,
RetentionPolicy = new Azure.Monitoring.Inputs.LogProfileRetentionPolicyArgs
{
Enabled = true,
Days = 7,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventhub"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/monitoring"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
"github.com/pulumi/pulumi/sdk/v3/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
}
exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
AccountTier: pulumi.String("Standard"),
AccountReplicationType: pulumi.String("GRS"),
})
if err != nil {
return err
}
exampleEventHubNamespace, err := eventhub.NewEventHubNamespace(ctx, "exampleEventHubNamespace", &eventhub.EventHubNamespaceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
Sku: pulumi.String("Standard"),
Capacity: pulumi.Int(2),
})
if err != nil {
return err
}
_, err = monitoring.NewLogProfile(ctx, "exampleLogProfile", &monitoring.LogProfileArgs{
Categories: pulumi.StringArray{
pulumi.String("Action"),
pulumi.String("Delete"),
pulumi.String("Write"),
},
Locations: pulumi.StringArray{
pulumi.String("westus"),
pulumi.String("global"),
},
ServicebusRuleId: exampleEventHubNamespace.ID().ApplyT(func(id string) (string, error) {
return fmt.Sprintf("%v/authorizationrules/RootManageSharedAccessKey", id), nil
}).(pulumi.StringOutput),
StorageAccountId: exampleAccount.ID(),
RetentionPolicy: &monitoring.LogProfileRetentionPolicyArgs{
Enabled: pulumi.Bool(true),
Days: pulumi.Int(7),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.eventhub.EventHubNamespace;
import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
import com.pulumi.azure.monitoring.LogProfile;
import com.pulumi.azure.monitoring.LogProfileArgs;
import com.pulumi.azure.monitoring.inputs.LogProfileRetentionPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("GRS")
.build());
var exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.sku("Standard")
.capacity(2)
.build());
var exampleLogProfile = new LogProfile("exampleLogProfile", LogProfileArgs.builder()
.categories(
"Action",
"Delete",
"Write")
.locations(
"westus",
"global")
.servicebusRuleId(exampleEventHubNamespace.id().applyValue(id -> String.format("%s/authorizationrules/RootManageSharedAccessKey", id)))
.storageAccountId(exampleAccount.id())
.retentionPolicy(LogProfileRetentionPolicyArgs.builder()
.enabled(true)
.days(7)
.build())
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
account_tier="Standard",
account_replication_type="GRS")
example_event_hub_namespace = azure.eventhub.EventHubNamespace("exampleEventHubNamespace",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
sku="Standard",
capacity=2)
example_log_profile = azure.monitoring.LogProfile("exampleLogProfile",
categories=[
"Action",
"Delete",
"Write",
],
locations=[
"westus",
"global",
],
servicebus_rule_id=example_event_hub_namespace.id.apply(lambda id: f"{id}/authorizationrules/RootManageSharedAccessKey"),
storage_account_id=example_account.id,
retention_policy=azure.monitoring.LogProfileRetentionPolicyArgs(
enabled=True,
days=7,
))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleAccount = new azure.storage.Account("exampleAccount", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
accountTier: "Standard",
accountReplicationType: "GRS",
});
const exampleEventHubNamespace = new azure.eventhub.EventHubNamespace("exampleEventHubNamespace", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
sku: "Standard",
capacity: 2,
});
const exampleLogProfile = new azure.monitoring.LogProfile("exampleLogProfile", {
categories: [
"Action",
"Delete",
"Write",
],
locations: [
"westus",
"global",
],
servicebusRuleId: pulumi.interpolate`${exampleEventHubNamespace.id}/authorizationrules/RootManageSharedAccessKey`,
storageAccountId: exampleAccount.id,
retentionPolicy: {
enabled: true,
days: 7,
},
});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleAccount:
type: azure:storage:Account
properties:
resourceGroupName: ${exampleResourceGroup.name}
location: ${exampleResourceGroup.location}
accountTier: Standard
accountReplicationType: GRS
exampleEventHubNamespace:
type: azure:eventhub:EventHubNamespace
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
sku: Standard
capacity: 2
exampleLogProfile:
type: azure:monitoring:LogProfile
properties:
categories:
- Action
- Delete
- Write
locations:
- westus
- global
# RootManageSharedAccessKey is created by default with listen, send, manage permissions
servicebusRuleId: ${exampleEventHubNamespace.id}/authorizationrules/RootManageSharedAccessKey
storageAccountId: ${exampleAccount.id}
retentionPolicy:
enabled: true
days: 7
Create LogProfile Resource
new LogProfile(name: string, args: LogProfileArgs, opts?: CustomResourceOptions);
@overload
def LogProfile(resource_name: str,
opts: Optional[ResourceOptions] = None,
categories: Optional[Sequence[str]] = None,
locations: Optional[Sequence[str]] = None,
name: Optional[str] = None,
retention_policy: Optional[LogProfileRetentionPolicyArgs] = None,
servicebus_rule_id: Optional[str] = None,
storage_account_id: Optional[str] = None)
@overload
def LogProfile(resource_name: str,
args: LogProfileArgs,
opts: Optional[ResourceOptions] = None)
func NewLogProfile(ctx *Context, name string, args LogProfileArgs, opts ...ResourceOption) (*LogProfile, error)
public LogProfile(string name, LogProfileArgs args, CustomResourceOptions? opts = null)
public LogProfile(String name, LogProfileArgs args)
public LogProfile(String name, LogProfileArgs args, CustomResourceOptions options)
type: azure:monitoring:LogProfile
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LogProfileArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args LogProfileArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args LogProfileArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LogProfileArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args LogProfileArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
LogProfile Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The LogProfile resource accepts the following input properties:
- Categories List<string>
List of categories of the logs.
- Locations List<string>
List of regions for which Activity Log events are stored or streamed.
- Retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- Name string
The name of the Log Profile. Changing this forces a new resource to be created.
- Servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- Storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- Categories []string
List of categories of the logs.
- Locations []string
List of regions for which Activity Log events are stored or streamed.
- Retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- Name string
The name of the Log Profile. Changing this forces a new resource to be created.
- Servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- Storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories List<String>
List of categories of the logs.
- locations List<String>
List of regions for which Activity Log events are stored or streamed.
- retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- name String
The name of the Log Profile. Changing this forces a new resource to be created.
- servicebus
Rule StringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account StringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories string[]
List of categories of the logs.
- locations string[]
List of regions for which Activity Log events are stored or streamed.
- retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- name string
The name of the Log Profile. Changing this forces a new resource to be created.
- servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories Sequence[str]
List of categories of the logs.
- locations Sequence[str]
List of regions for which Activity Log events are stored or streamed.
- retention_
policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- name str
The name of the Log Profile. Changing this forces a new resource to be created.
- servicebus_
rule_ strid The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage_
account_ strid The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories List<String>
List of categories of the logs.
- locations List<String>
List of regions for which Activity Log events are stored or streamed.
- retention
Policy Property Map A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- name String
The name of the Log Profile. Changing this forces a new resource to be created.
- servicebus
Rule StringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account StringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
Outputs
All input properties are implicitly available as output properties. Additionally, the LogProfile resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing LogProfile Resource
Get an existing LogProfile 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?: LogProfileState, opts?: CustomResourceOptions): LogProfile
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
categories: Optional[Sequence[str]] = None,
locations: Optional[Sequence[str]] = None,
name: Optional[str] = None,
retention_policy: Optional[LogProfileRetentionPolicyArgs] = None,
servicebus_rule_id: Optional[str] = None,
storage_account_id: Optional[str] = None) -> LogProfile
func GetLogProfile(ctx *Context, name string, id IDInput, state *LogProfileState, opts ...ResourceOption) (*LogProfile, error)
public static LogProfile Get(string name, Input<string> id, LogProfileState? state, CustomResourceOptions? opts = null)
public static LogProfile get(String name, Output<String> id, LogProfileState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Categories List<string>
List of categories of the logs.
- Locations List<string>
List of regions for which Activity Log events are stored or streamed.
- Name string
The name of the Log Profile. Changing this forces a new resource to be created.
- Retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- Servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- Storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- Categories []string
List of categories of the logs.
- Locations []string
List of regions for which Activity Log events are stored or streamed.
- Name string
The name of the Log Profile. Changing this forces a new resource to be created.
- Retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- Servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- Storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories List<String>
List of categories of the logs.
- locations List<String>
List of regions for which Activity Log events are stored or streamed.
- name String
The name of the Log Profile. Changing this forces a new resource to be created.
- retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- servicebus
Rule StringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account StringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories string[]
List of categories of the logs.
- locations string[]
List of regions for which Activity Log events are stored or streamed.
- name string
The name of the Log Profile. Changing this forces a new resource to be created.
- retention
Policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- servicebus
Rule stringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account stringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories Sequence[str]
List of categories of the logs.
- locations Sequence[str]
List of regions for which Activity Log events are stored or streamed.
- name str
The name of the Log Profile. Changing this forces a new resource to be created.
- retention_
policy LogProfile Retention Policy Args A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- servicebus_
rule_ strid The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage_
account_ strid The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
- categories List<String>
List of categories of the logs.
- locations List<String>
List of regions for which Activity Log events are stored or streamed.
- name String
The name of the Log Profile. Changing this forces a new resource to be created.
- retention
Policy Property Map A
retention_policy
block as documented below. A retention policy for how long Activity Logs are retained in the storage account.- servicebus
Rule StringId The service bus (or event hub) rule ID of the service bus (or event hub) namespace in which the Activity Log is streamed to. At least one of
storage_account_id
orservicebus_rule_id
must be set.- storage
Account StringId The resource ID of the storage account in which the Activity Log is stored. At least one of
storage_account_id
orservicebus_rule_id
must be set.
Supporting Types
LogProfileRetentionPolicy
Import
A Log Profile can be imported using the resource id
, e.g.
$ pulumi import azure:monitoring/logProfile:LogProfile example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/logProfiles/test
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.