Share via


Microsoft.Security workspaceSettings

Bicep resource definition

The workspaceSettings 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.Security/workspaceSettings resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Security/workspaceSettings@2017-08-01-preview' = {
  scope: resourceSymbolicName or scope
  name: 'string'
  properties: {
    scope: 'string'
    workspaceId: 'string'
  }
}

Property Values

Microsoft.Security/workspaceSettings

Name Description Value
name The resource name string (required)
properties Workspace setting data WorkspaceSettingProperties
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.

WorkspaceSettingProperties

Name Description Value
scope All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting with more specific scope string (required)
workspaceId The full Azure ID of the workspace to save the data in string (required)

ARM template resource definition

The workspaceSettings 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.Security/workspaceSettings resource, add the following JSON to your template.

{
  "type": "Microsoft.Security/workspaceSettings",
  "apiVersion": "2017-08-01-preview",
  "name": "string",
  "properties": {
    "scope": "string",
    "workspaceId": "string"
  }
}

Property Values

Microsoft.Security/workspaceSettings

Name Description Value
apiVersion The api version '2017-08-01-preview'
name The resource name string (required)
properties Workspace setting data WorkspaceSettingProperties
type The resource type 'Microsoft.Security/workspaceSettings'

WorkspaceSettingProperties

Name Description Value
scope All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting with more specific scope string (required)
workspaceId The full Azure ID of the workspace to save the data in string (required)

Usage Examples

Terraform (AzAPI provider) resource definition

The workspaceSettings 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.Security/workspaceSettings resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Security/workspaceSettings@2017-08-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      scope = "string"
      workspaceId = "string"
    }
  }
}

Property Values

Microsoft.Security/workspaceSettings

Name Description Value
name The resource name string (required)
parent_id The ID of the resource to apply this extension resource to. string (required)
properties Workspace setting data WorkspaceSettingProperties
type The resource type "Microsoft.Security/workspaceSettings@2017-08-01-preview"

WorkspaceSettingProperties

Name Description Value
scope All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting with more specific scope string (required)
workspaceId The full Azure ID of the workspace to save the data in string (required)

Usage Examples

Terraform Samples

A basic example of deploying subscription's Security Center Workspace.

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" "workspace" {
  type      = "Microsoft.OperationalInsights/workspaces@2022-10-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      features = {
        disableLocalAuth                            = false
        enableLogAccessUsingOnlyResourcePermissions = true
      }
      publicNetworkAccessForIngestion = "Enabled"
      publicNetworkAccessForQuery     = "Enabled"
      retentionInDays                 = 30
      sku = {
        name = "PerGB2018"
      }
      workspaceCapping = {
        dailyQuotaGb = -1
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "workspaceSetting" {
  type      = "Microsoft.Security/workspaceSettings@2017-08-01-preview"
  parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  name      = "default"
  body = {
    properties = {
      scope       = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
      workspaceId = azapi_resource.workspace.id
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}