We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.
Example Usage
Subscription Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var current = Output.Create(Azure.Core.GetSubscription.InvokeAsync());
var subscription_level = new Azure.Management.Lock("subscription-level", new Azure.Management.LockArgs
{
Scope = current.Apply(current => current.Id),
LockLevel = "CanNotDelete",
Notes = "Items can't be deleted in this subscription!",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/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
})
}
Example coming soon!
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!",
});
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!")
Example coming soon!
## Example Usage (Resource Group Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = new Azure.Core.ResourceGroup("example", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var resource_group_level = new Azure.Management.Lock("resource-group-level", new Azure.Management.LockArgs
{
Scope = example.Id,
LockLevel = "ReadOnly",
Notes = "This Resource Group is Read-Only",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/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
})
}
Example coming soon!
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",
});
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")
Example coming soon!
Resource Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new Azure.Network.PublicIpArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
AllocationMethod = "Static",
IdleTimeoutInMinutes = 30,
});
var public_ip = new Azure.Management.Lock("public-ip", new Azure.Management.LockArgs
{
Scope = examplePublicIp.Id,
LockLevel = "CanNotDelete",
Notes = "Locked because it's needed by a third-party",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/management"
"github.com/pulumi/pulumi-azure/sdk/v4/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
})
}
Example coming soon!
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",
});
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")
Example coming soon!
Create ManangementLock Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ManangementLock(name: string, args: ManangementLockArgs, opts?: CustomResourceOptions);@overload
def ManangementLock(resource_name: str,
args: ManangementLockArgs,
opts: Optional[ResourceOptions] = None)
@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)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.
Parameters
- 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ManangementLock resource accepts the following input properties:
- Lock
Level string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 String - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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
CanNotDeleteandReadOnly. 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.
- lock
Level String - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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) -> ManangementLockfunc 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)resources: _: type: azure:managementresource:ManangementLock get: id: ${id}- 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.
- Lock
Level string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 String - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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 string - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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
CanNotDeleteandReadOnly. 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.
- lock
Level String - Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
