TagAtScopeArgs

data class TagAtScopeArgs(val properties: Output<TagsArgs>? = null, val scope: Output<String>? = null) : ConvertibleToJava<TagAtScopeArgs>

Wrapper resource for tags API requests and responses. Uses Azure REST API version 2024-03-01. In version 2.x of the Azure Native provider, it used API version 2022-09-01. Other available API versions: 2020-10-01, 2021-01-01, 2021-04-01, 2022-09-01, 2023-07-01, 2024-07-01, 2024-11-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native resources [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

Update tags on a resource

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var tagAtScope = new AzureNative.Resources.TagAtScope("tagAtScope", new()
{
Properties = new AzureNative.Resources.Inputs.TagsArgs
{
Tags =
{
{ "tagKey1", "tag-value-1" },
{ "tagKey2", "tag-value-2" },
},
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm",
});
});
package main
import (
resources "github.com/pulumi/pulumi-azure-native-sdk/resources/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := resources.NewTagAtScope(ctx, "tagAtScope", &resources.TagAtScopeArgs{
Properties: &resources.TagsArgs{
Tags: pulumi.StringMap{
"tagKey1": pulumi.String("tag-value-1"),
"tagKey2": pulumi.String("tag-value-2"),
},
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm"),
})
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.azurenative.resources.TagAtScope;
import com.pulumi.azurenative.resources.TagAtScopeArgs;
import com.pulumi.azurenative.resources.inputs.TagsArgs;
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 tagAtScope = new TagAtScope("tagAtScope", TagAtScopeArgs.builder()
.properties(TagsArgs.builder()
.tags(Map.ofEntries(
Map.entry("tagKey1", "tag-value-1"),
Map.entry("tagKey2", "tag-value-2")
))
.build())
.scope("subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm")
.build());
}
}

Update tags on a subscription

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var tagAtScope = new AzureNative.Resources.TagAtScope("tagAtScope", new()
{
Properties = new AzureNative.Resources.Inputs.TagsArgs
{
Tags =
{
{ "tagKey1", "tag-value-1" },
{ "tagKey2", "tag-value-2" },
},
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
});
});
package main
import (
resources "github.com/pulumi/pulumi-azure-native-sdk/resources/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := resources.NewTagAtScope(ctx, "tagAtScope", &resources.TagAtScopeArgs{
Properties: &resources.TagsArgs{
Tags: pulumi.StringMap{
"tagKey1": pulumi.String("tag-value-1"),
"tagKey2": pulumi.String("tag-value-2"),
},
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000"),
})
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.azurenative.resources.TagAtScope;
import com.pulumi.azurenative.resources.TagAtScopeArgs;
import com.pulumi.azurenative.resources.inputs.TagsArgs;
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 tagAtScope = new TagAtScope("tagAtScope", TagAtScopeArgs.builder()
.properties(TagsArgs.builder()
.tags(Map.ofEntries(
Map.entry("tagKey1", "tag-value-1"),
Map.entry("tagKey2", "tag-value-2")
))
.build())
.scope("subscriptions/00000000-0000-0000-0000-000000000000")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:resources:TagAtScope myresource1 /{scope}/providers/Microsoft.Resources/tags/default

Constructors

Link copied to clipboard
constructor(properties: Output<TagsArgs>? = null, scope: Output<String>? = null)

Properties

Link copied to clipboard
val properties: Output<TagsArgs>? = null

The set of tags.

Link copied to clipboard
val scope: Output<String>? = null

The resource scope.

Functions

Link copied to clipboard
open override fun toJava(): TagAtScopeArgs