Creates or updates an association.
PUT https://management.azure.com/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}?api-version=2024-03-11
URI Parameters
| Name |
In |
Required |
Type |
Description |
|
associationName
|
path |
True
|
string
|
The name of the association. The name is case insensitive.
|
|
resourceUri
|
path |
True
|
string
minLength: 1
|
The fully qualified Azure Resource manager identifier of the resource.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
The API version to use for this operation.
|
Request Body
| Name |
Type |
Description |
|
properties.dataCollectionEndpointId
|
string
|
The resource ID of the data collection endpoint that is to be associated.
|
|
properties.dataCollectionRuleId
|
string
|
The resource ID of the data collection rule that is to be associated.
|
|
properties.description
|
string
|
Description of the association.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name |
Description |
|
user_impersonation
|
impersonate your user account
|
Examples
Create or update association
Sample request
PUT https://management.azure.com/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation?api-version=2024-03-11
{
"properties": {
"dataCollectionRuleId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"
}
}
import com.azure.resourcemanager.monitor.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner;
/**
* Samples for DataCollectionRuleAssociations Create.
*/
public final class Main {
/*
* x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreate.json
*/
/**
* Sample code: Create or update association.
*
* @param manager Entry point to MonitorManager.
*/
public static void createOrUpdateAssociation(com.azure.resourcemanager.monitor.MonitorManager manager) {
manager.serviceClient().getDataCollectionRuleAssociations().createWithResponse(
"subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
"myAssociation",
new DataCollectionRuleAssociationProxyOnlyResourceInner().withDataCollectionRuleId(
"/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python data_collection_rule_associations_create.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.data_collection_rule_associations.create(
resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
association_name="myAssociation",
)
print(response)
# x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: 2024-03-11/DataCollectionRuleAssociationsCreate.json
func ExampleDataCollectionRuleAssociationsClient_Create_createOrUpdateAssociation() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", armmonitor.DataCollectionRuleAssociationProxyOnlyResource{
Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{
DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armmonitor.DataCollectionRuleAssociationsClientCreateResponse{
// DataCollectionRuleAssociationProxyOnlyResource: armmonitor.DataCollectionRuleAssociationProxyOnlyResource{
// Name: to.Ptr("myAssociation"),
// Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"),
// Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"),
// ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"),
// Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{
// DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"),
// },
// SystemData: &armmonitor.SystemData{
// CreatedAt: to.Ptr(time.Date(2024, time.March, 22, 19, 15, 8, 215515600, time.UTC)),
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(time.Date(2024, time.March, 22, 19, 15, 8, 215515600, time.UTC)),
// LastModifiedBy: to.Ptr("user1"),
// LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an association.
*
* @summary creates or updates an association.
* x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreate.json
*/
async function createOrUpdateAssociation() {
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential);
const result = await client.dataCollectionRuleAssociations.create(
"subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
"myAssociation",
{
body: {
dataCollectionRuleId:
"/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule",
},
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"name": "myAssociation",
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"etag": "00000836-0000-0100-0000-65fdd8bc0000",
"id": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation",
"properties": {
"dataCollectionRuleId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"
},
"systemData": {
"createdAt": "2024-03-22T19:15:08.2155156Z",
"createdBy": "user1",
"createdByType": "User",
"lastModifiedAt": "2024-03-22T19:15:08.2155156Z",
"lastModifiedBy": "user1",
"lastModifiedByType": "User"
}
}
{
"name": "myAssociation",
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"etag": "00000836-0000-0100-0000-65fdd8bc0000",
"id": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation",
"properties": {
"dataCollectionRuleId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"
},
"systemData": {
"createdAt": "2024-03-22T19:15:08.2155156Z",
"createdBy": "user1",
"createdByType": "User",
"lastModifiedAt": "2024-03-22T19:15:08.2155156Z",
"lastModifiedBy": "user1",
"lastModifiedByType": "User"
}
}
Create or update association with a data collection endpoint
Sample request
PUT https://management.azure.com/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint?api-version=2024-03-11
{
"properties": {
"dataCollectionEndpointId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"
}
}
import com.azure.resourcemanager.monitor.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner;
/**
* Samples for DataCollectionRuleAssociations Create.
*/
public final class Main {
/*
* x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreateEndpointAssoc.json
*/
/**
* Sample code: Create or update association with a data collection endpoint.
*
* @param manager Entry point to MonitorManager.
*/
public static void
createOrUpdateAssociationWithADataCollectionEndpoint(com.azure.resourcemanager.monitor.MonitorManager manager) {
manager.serviceClient().getDataCollectionRuleAssociations().createWithResponse(
"subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
"configurationAccessEndpoint",
new DataCollectionRuleAssociationProxyOnlyResourceInner().withDataCollectionEndpointId(
"/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python data_collection_rule_associations_create_endpoint_assoc.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.data_collection_rule_associations.create(
resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
association_name="configurationAccessEndpoint",
)
print(response)
# x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreateEndpointAssoc.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: 2024-03-11/DataCollectionRuleAssociationsCreateEndpointAssoc.json
func ExampleDataCollectionRuleAssociationsClient_Create_createOrUpdateAssociationWithADataCollectionEndpoint() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "configurationAccessEndpoint", armmonitor.DataCollectionRuleAssociationProxyOnlyResource{
Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{
DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armmonitor.DataCollectionRuleAssociationsClientCreateResponse{
// DataCollectionRuleAssociationProxyOnlyResource: armmonitor.DataCollectionRuleAssociationProxyOnlyResource{
// Name: to.Ptr("configurationAccessEndpoint"),
// Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"),
// Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"),
// ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint"),
// Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{
// DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"),
// },
// SystemData: &armmonitor.SystemData{
// CreatedAt: to.Ptr(time.Date(2024, time.March, 22, 19, 15, 8, 215515600, time.UTC)),
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(time.Date(2024, time.March, 22, 19, 15, 8, 215515600, time.UTC)),
// LastModifiedBy: to.Ptr("user1"),
// LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates an association.
*
* @summary creates or updates an association.
* x-ms-original-file: 2024-03-11/DataCollectionRuleAssociationsCreateEndpointAssoc.json
*/
async function createOrUpdateAssociationWithADataCollectionEndpoint() {
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential);
const result = await client.dataCollectionRuleAssociations.create(
"subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm",
"configurationAccessEndpoint",
{
body: {
dataCollectionEndpointId:
"/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint",
},
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"name": "configurationAccessEndpoint",
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"etag": "00000836-0000-0100-0000-65fdd8bc0000",
"id": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint",
"properties": {
"dataCollectionEndpointId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"
},
"systemData": {
"createdAt": "2024-03-22T19:15:08.2155156Z",
"createdBy": "user1",
"createdByType": "User",
"lastModifiedAt": "2024-03-22T19:15:08.2155156Z",
"lastModifiedBy": "user1",
"lastModifiedByType": "User"
}
}
{
"name": "configurationAccessEndpoint",
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"etag": "00000836-0000-0100-0000-65fdd8bc0000",
"id": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint",
"properties": {
"dataCollectionEndpointId": "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"
},
"systemData": {
"createdAt": "2024-03-22T19:15:08.2155156Z",
"createdBy": "user1",
"createdByType": "User",
"lastModifiedAt": "2024-03-22T19:15:08.2155156Z",
"lastModifiedBy": "user1",
"lastModifiedByType": "User"
}
}
Definitions
createdByType
Enumeration
The type of identity that created the resource.
| Value |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
Object
Metadata about the resource
| Name |
Type |
Description |
|
provisionedBy
|
string
|
Azure offering managing this resource on-behalf-of customer.
|
|
provisionedByImmutableId
|
string
|
Immutable Id of azure offering managing this resource on-behalf-of customer.
|
|
provisionedByResourceId
|
string
|
Resource Id of azure offering managing this resource on-behalf-of customer.
|
DataCollectionRuleAssociationProxyOnlyResource
Object
Definition of generic ARM proxy resource.
| Name |
Type |
Description |
|
etag
|
string
|
Resource entity tag (ETag).
|
|
id
|
string
(arm-id)
|
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
name
|
string
|
The name of the resource
|
|
properties.dataCollectionEndpointId
|
string
|
The resource ID of the data collection endpoint that is to be associated.
|
|
properties.dataCollectionRuleId
|
string
|
The resource ID of the data collection rule that is to be associated.
|
|
properties.description
|
string
|
Description of the association.
|
|
properties.metadata
|
DataCollectionRuleAssociationMetadata
|
Metadata about the resource
|
|
properties.provisioningState
|
KnownDataCollectionRuleAssociationProvisioningState
|
The resource provisioning state.
|
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
ErrorAdditionalInfo
Object
The resource management error additional info.
| Name |
Type |
Description |
|
info
|
object
|
The additional info.
|
|
type
|
string
|
The additional info type.
|
ErrorDetail
Object
The error detail.
| Name |
Type |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
|
code
|
string
|
The error code.
|
|
details
|
ErrorDetail[]
|
The error details.
|
|
message
|
string
|
The error message.
|
|
target
|
string
|
The error target.
|
ErrorResponseCommonV2
Object
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
| Name |
Type |
Description |
|
error
|
ErrorDetail
|
The error object.
|
KnownDataCollectionRuleAssociationProvisioningState
Enumeration
The resource provisioning state.
| Value |
Description |
|
Creating
|
Creating
|
|
Updating
|
Updating
|
|
Deleting
|
Deleting
|
|
Succeeded
|
Succeeded
|
|
Canceled
|
Canceled
|
|
Failed
|
Failed
|
systemData
Object
Metadata pertaining to creation and last modification of the resource.
| Name |
Type |
Description |
|
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
|
createdBy
|
string
|
The identity that created the resource.
|
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource last modification (UTC)
|
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|