azure.managementresource.ManangementLock

Deprecated:

azure.managementresource.ManangementLock has been deprecated in favor of azure.management.Lock

Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.

Example Usage

Subscription Level Lock)

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var current = Azure.Core.GetSubscription.Invoke();

    var subscription_level = new Azure.Management.Lock("subscription-level", new()
    {
        Scope = current.Apply(getSubscriptionResult => getSubscriptionResult.Id),
        LockLevel = "CanNotDelete",
        Notes = "Items can't be deleted in this subscription!",
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := core.LookupSubscription(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = management.NewLock(ctx, "subscription-level", &management.LockArgs{
			Scope:     *pulumi.String(current.Id),
			LockLevel: pulumi.String("CanNotDelete"),
			Notes:     pulumi.String("Items can't be deleted in this subscription!"),
		})
		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.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.LockArgs;
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) {
        final var current = CoreFunctions.getSubscription();

        var subscription_level = new Lock("subscription-level", LockArgs.builder()        
            .scope(current.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
            .lockLevel("CanNotDelete")
            .notes("Items can't be deleted in this subscription!")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

current = azure.core.get_subscription()
subscription_level = azure.management.Lock("subscription-level",
    scope=current.id,
    lock_level="CanNotDelete",
    notes="Items can't be deleted in this subscription!")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getSubscription({});
const subscription_level = new azure.management.Lock("subscription-level", {
    scope: current.then(current => current.id),
    lockLevel: "CanNotDelete",
    notes: "Items can't be deleted in this subscription!",
});
resources:
  subscription-level:
    type: azure:management:Lock
    properties:
      scope: ${current.id}
      lockLevel: CanNotDelete
      notes: Items can't be deleted in this subscription!
variables:
  current:
    fn::invoke:
      Function: azure:core:getSubscription
      Arguments: {}

Resource Group Level Lock)

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Location = "West Europe",
    });

    var resource_group_level = new Azure.Management.Lock("resource-group-level", new()
    {
        Scope = example.Id,
        LockLevel = "ReadOnly",
        Notes = "This Resource Group is Read-Only",
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		_, err = management.NewLock(ctx, "resource-group-level", &management.LockArgs{
			Scope:     example.ID(),
			LockLevel: pulumi.String("ReadOnly"),
			Notes:     pulumi.String("This Resource Group is Read-Only"),
		})
		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.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.LockArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var resource_group_level = new Lock("resource-group-level", LockArgs.builder()        
            .scope(example.id())
            .lockLevel("ReadOnly")
            .notes("This Resource Group is Read-Only")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example", location="West Europe")
resource_group_level = azure.management.Lock("resource-group-level",
    scope=example.id,
    lock_level="ReadOnly",
    notes="This Resource Group is Read-Only")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {location: "West Europe"});
const resource_group_level = new azure.management.Lock("resource-group-level", {
    scope: example.id,
    lockLevel: "ReadOnly",
    notes: "This Resource Group is Read-Only",
});
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  resource-group-level:
    type: azure:management:Lock
    properties:
      scope: ${example.id}
      lockLevel: ReadOnly
      notes: This Resource Group is Read-Only

Resource Level Lock)

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        AllocationMethod = "Static",
        IdleTimeoutInMinutes = 30,
    });

    var public_ip = new Azure.Management.Lock("public-ip", new()
    {
        Scope = examplePublicIp.Id,
        LockLevel = "CanNotDelete",
        Notes = "Locked because it's needed by a third-party",
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		examplePublicIp, err := network.NewPublicIp(ctx, "examplePublicIp", &network.PublicIpArgs{
			Location:             exampleResourceGroup.Location,
			ResourceGroupName:    exampleResourceGroup.Name,
			AllocationMethod:     pulumi.String("Static"),
			IdleTimeoutInMinutes: pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		_, err = management.NewLock(ctx, "public-ip", &management.LockArgs{
			Scope:     examplePublicIp.ID(),
			LockLevel: pulumi.String("CanNotDelete"),
			Notes:     pulumi.String("Locked because it's needed by a third-party"),
		})
		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.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.PublicIp;
import com.pulumi.azure.network.PublicIpArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.LockArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .allocationMethod("Static")
            .idleTimeoutInMinutes(30)
            .build());

        var public_ip = new Lock("public-ip", LockArgs.builder()        
            .scope(examplePublicIp.id())
            .lockLevel("CanNotDelete")
            .notes("Locked because it's needed by a third-party")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_public_ip = azure.network.PublicIp("examplePublicIp",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    allocation_method="Static",
    idle_timeout_in_minutes=30)
public_ip = azure.management.Lock("public-ip",
    scope=example_public_ip.id,
    lock_level="CanNotDelete",
    notes="Locked because it's needed by a third-party")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const examplePublicIp = new azure.network.PublicIp("examplePublicIp", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    allocationMethod: "Static",
    idleTimeoutInMinutes: 30,
});
const public_ip = new azure.management.Lock("public-ip", {
    scope: examplePublicIp.id,
    lockLevel: "CanNotDelete",
    notes: "Locked because it's needed by a third-party",
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  examplePublicIp:
    type: azure:network:PublicIp
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      allocationMethod: Static
      idleTimeoutInMinutes: 30
  public-ip:
    type: azure:management:Lock
    properties:
      scope: ${examplePublicIp.id}
      lockLevel: CanNotDelete
      notes: Locked because it's needed by a third-party

Create ManangementLock Resource

new ManangementLock(name: string, args: ManangementLockArgs, opts?: CustomResourceOptions);
@overload
def ManangementLock(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    lock_level: Optional[str] = None,
                    name: Optional[str] = None,
                    notes: Optional[str] = None,
                    scope: Optional[str] = None)
@overload
def ManangementLock(resource_name: str,
                    args: ManangementLockArgs,
                    opts: Optional[ResourceOptions] = None)
func NewManangementLock(ctx *Context, name string, args ManangementLockArgs, opts ...ResourceOption) (*ManangementLock, error)
public ManangementLock(string name, ManangementLockArgs args, CustomResourceOptions? opts = null)
public ManangementLock(String name, ManangementLockArgs args)
public ManangementLock(String name, ManangementLockArgs args, CustomResourceOptions options)
type: azure:managementresource:ManangementLock
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ManangementLockArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ManangementLockArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ManangementLockArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ManangementLockArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ManangementLockArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ManangementLock Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ManangementLock resource accepts the following input properties:

LockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

Scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

Name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

Notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

LockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

Scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

Name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

Notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

lockLevel String

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

scope String

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

name String

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes String

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

lockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

lock_level str

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

scope str

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

name str

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes str

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

lockLevel String

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

scope String

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

name String

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes String

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the ManangementLock resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing ManangementLock Resource

Get an existing ManangementLock resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ManangementLockState, opts?: CustomResourceOptions): ManangementLock
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        lock_level: Optional[str] = None,
        name: Optional[str] = None,
        notes: Optional[str] = None,
        scope: Optional[str] = None) -> ManangementLock
func GetManangementLock(ctx *Context, name string, id IDInput, state *ManangementLockState, opts ...ResourceOption) (*ManangementLock, error)
public static ManangementLock Get(string name, Input<string> id, ManangementLockState? state, CustomResourceOptions? opts = null)
public static ManangementLock get(String name, Output<String> id, ManangementLockState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
LockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

Name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

Notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

Scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

LockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

Name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

Notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

Scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

lockLevel String

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

name String

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes String

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

scope String

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

lockLevel string

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

name string

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes string

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

scope string

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

lock_level str

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

name str

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes str

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

scope str

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

lockLevel String

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

name String

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

notes String

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

scope String

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.

Import

Management Locks can be imported using the resource id, e.g.

 $ pulumi import azure:managementresource/manangementLock:ManangementLock lock1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Authorization/locks/lock1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.