service_diagnostic_settings
Creates, updates, deletes, gets or lists a service_diagnostic_settings resource.
Overview
| Name | service_diagnostic_settings |
| Type | Resource |
| Id | azure.monitor.service_diagnostic_settings |
Fields
The following fields are returned by SELECT queries:
- get
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
eventHubAuthorizationRuleId | string | The resource Id for the event hub namespace authorization rule. |
location | string | Resource location. Required. |
logs | array | the list of logs settings. |
metrics | array | the list of metric settings. |
serviceBusRuleId | string | The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. |
storageAccountId | string | The resource ID of the storage account to which you would like to send Diagnostic Logs. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
workspaceId | string | The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_uri | Gets the active diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases. | |
create_or_update | insert | resource_uri, location | Create or update new diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases. | |
update | update | resource_uri | Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. WARNING: This method will be deprecated in future releases. | |
create_or_update | replace | resource_uri, location | Create or update new diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
resource_uri | string | The fully qualified Azure Resource manager identifier of the resource. Required. |
SELECT examples
- get
Gets the active diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases.
SELECT
id,
name,
eventHubAuthorizationRuleId,
location,
logs,
metrics,
serviceBusRuleId,
storageAccountId,
systemData,
tags,
type,
workspaceId
FROM azure.monitor.service_diagnostic_settings
WHERE resource_uri = '{{ resource_uri }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Create or update new diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases.
INSERT INTO azure.monitor.service_diagnostic_settings (
properties,
location,
tags,
resource_uri
)
SELECT
'{{ properties }}',
'{{ location }}' /* required */,
'{{ tags }}',
'{{ resource_uri }}'
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: service_diagnostic_settings
props:
- name: resource_uri
value: "{{ resource_uri }}"
description: Required parameter for the service_diagnostic_settings resource.
- name: properties
description: |
The service diagnostics settings of the resource.
value:
storageAccountId: "{{ storageAccountId }}"
serviceBusRuleId: "{{ serviceBusRuleId }}"
eventHubAuthorizationRuleId: "{{ eventHubAuthorizationRuleId }}"
metrics:
- timeGrain: "{{ timeGrain }}"
category: "{{ category }}"
enabled: {{ enabled }}
retentionPolicy:
enabled: {{ enabled }}
days: {{ days }}
logs:
- category: "{{ category }}"
categoryGroup: "{{ categoryGroup }}"
enabled: {{ enabled }}
retentionPolicy:
enabled: {{ enabled }}
days: {{ days }}
workspaceId: "{{ workspaceId }}"
- name: location
value: "{{ location }}"
description: |
Resource location. Required.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
UPDATE examples
- update
Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. WARNING: This method will be deprecated in future releases.
UPDATE azure.monitor.service_diagnostic_settings
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_uri = '{{ resource_uri }}' --required
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type;
REPLACE examples
- create_or_update
Create or update new diagnostic settings for the specified resource. WARNING: This method will be deprecated in future releases.
REPLACE azure.monitor.service_diagnostic_settings
SET
properties = '{{ properties }}',
location = '{{ location }}',
tags = '{{ tags }}'
WHERE
resource_uri = '{{ resource_uri }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type;