Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Bicep resource definition
The logprofiles resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Insights/logprofiles resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Insights/logprofiles@2016-03-01' = {
scope: resourceSymbolicName or scope
location: 'string'
name: 'string'
properties: {
categories: [
'string'
]
locations: [
'string'
]
retentionPolicy: {
days: int
enabled: bool
}
serviceBusRuleId: 'string'
storageAccountId: 'string'
}
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.Insights/logprofiles
| Name | Description | Value |
|---|---|---|
| location | Resource location | string (required) |
| name | The resource name | string (required) |
| properties | The log profile properties of the resource. | LogProfileProperties (required) |
| scope | Use when creating a resource at a scope that is different than the deployment scope. | Set this property to the symbolic name of a resource to apply the extension resource. |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
LogProfileProperties
| Name | Description | Value |
|---|---|---|
| categories | the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' | string[] (required) |
| locations | List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. | string[] (required) |
| retentionPolicy | the retention policy for the events in the log. | RetentionPolicy (required) |
| serviceBusRuleId | The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. | string |
| storageAccountId | the resource id of the storage account to which you would like to send the Activity Log. | string |
ResourceTags
| Name | Description | Value |
|---|
RetentionPolicy
| Name | Description | Value |
|---|---|---|
| days | the number of days for the retention in days. A value of 0 will retain the events indefinitely. | int Constraints: Min value = 0 (required) |
| enabled | a value indicating whether the retention policy is enabled. | bool (required) |
ARM template resource definition
The logprofiles resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Insights/logprofiles resource, add the following JSON to your template.
{
"type": "Microsoft.Insights/logprofiles",
"apiVersion": "2016-03-01",
"name": "string",
"location": "string",
"properties": {
"categories": [ "string" ],
"locations": [ "string" ],
"retentionPolicy": {
"days": "int",
"enabled": "bool"
},
"serviceBusRuleId": "string",
"storageAccountId": "string"
},
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.Insights/logprofiles
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2016-03-01' |
| location | Resource location | string (required) |
| name | The resource name | string (required) |
| properties | The log profile properties of the resource. | LogProfileProperties (required) |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
| type | The resource type | 'Microsoft.Insights/logprofiles' |
LogProfileProperties
| Name | Description | Value |
|---|---|---|
| categories | the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' | string[] (required) |
| locations | List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. | string[] (required) |
| retentionPolicy | the retention policy for the events in the log. | RetentionPolicy (required) |
| serviceBusRuleId | The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. | string |
| storageAccountId | the resource id of the storage account to which you would like to send the Activity Log. | string |
ResourceTags
| Name | Description | Value |
|---|
RetentionPolicy
| Name | Description | Value |
|---|---|---|
| days | the number of days for the retention in days. A value of 0 will retain the events indefinitely. | int Constraints: Min value = 0 (required) |
| enabled | a value indicating whether the retention policy is enabled. | bool (required) |
Usage Examples
Terraform (AzAPI provider) resource definition
The logprofiles resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Insights/logprofiles resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Insights/logprofiles@2016-03-01"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
categories = [
"string"
]
locations = [
"string"
]
retentionPolicy = {
days = int
enabled = bool
}
serviceBusRuleId = "string"
storageAccountId = "string"
}
}
}
Property Values
Microsoft.Insights/logprofiles
| Name | Description | Value |
|---|---|---|
| location | Resource location | string (required) |
| name | The resource name | string (required) |
| parent_id | The ID of the resource to apply this extension resource to. | string (required) |
| properties | The log profile properties of the resource. | LogProfileProperties (required) |
| tags | Resource tags | Dictionary of tag names and values. |
| type | The resource type | "Microsoft.Insights/logprofiles@2016-03-01" |
LogProfileProperties
| Name | Description | Value |
|---|---|---|
| categories | the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' | string[] (required) |
| locations | List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. | string[] (required) |
| retentionPolicy | the retention policy for the events in the log. | RetentionPolicy (required) |
| serviceBusRuleId | The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. | string |
| storageAccountId | the resource id of the storage account to which you would like to send the Activity Log. | string |
ResourceTags
| Name | Description | Value |
|---|
RetentionPolicy
| Name | Description | Value |
|---|---|---|
| days | the number of days for the retention in days. A value of 0 will retain the events indefinitely. | int Constraints: Min value = 0 (required) |
| enabled | a value indicating whether the retention policy is enabled. | bool (required) |
Usage Examples
Terraform Samples
A basic example of deploying Insights Log Profiles.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
data "azurerm_client_config" "current" {
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "storageAccount" {
type = "Microsoft.Storage/storageAccounts@2021-09-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
kind = "StorageV2"
properties = {
accessTier = "Hot"
allowBlobPublicAccess = true
allowCrossTenantReplication = true
allowSharedKeyAccess = true
defaultToOAuthAuthentication = false
encryption = {
keySource = "Microsoft.Storage"
services = {
queue = {
keyType = "Service"
}
table = {
keyType = "Service"
}
}
}
isHnsEnabled = false
isNfsV3Enabled = false
isSftpEnabled = false
minimumTlsVersion = "TLS1_2"
networkAcls = {
defaultAction = "Allow"
}
publicNetworkAccess = "Enabled"
supportsHttpsTrafficOnly = true
}
sku = {
name = "Standard_GRS"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "logProfile" {
type = "Microsoft.Insights/logProfiles@2016-03-01"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
name = var.resource_name
location = ""
body = {
properties = {
categories = [
"Action",
]
locations = [
"westeurope",
"westeurope",
]
retentionPolicy = {
days = 7
enabled = true
}
storageAccountId = azapi_resource.storageAccount.id
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}