Set-AzResourceLock
Modifies a resource lock.
Syntax
BySpecifiedScope (Default)
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
-Scope <String>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByResourceGroup
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
-ResourceGroupName <String>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByResourceGroupLevel
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
-ResourceName <String>
-ResourceType <String>
-ResourceGroupName <String>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
BySubscription
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
BySubscriptionLevel
Set-AzResourceLock
-LockName <String>
-LockLevel <LockLevel>
-ResourceName <String>
-ResourceType <String>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByLockId
Set-AzResourceLock
-LockLevel <LockLevel>
-LockId <String>
[-LockNotes <String>]
[-Force]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzResourceLock cmdlet modifies a resource lock.
Examples
Example 1: Update notes for a lock
Set-AzResourceLock -LockLevel CanNotDelete -LockNotes "Updated note" -LockName "ContosoSiteLock" -ResourceName "ContosoSite" -ResourceType "microsoft.web/sites" -ResourceGroupName "ResourceGroup11"
This command updates the note for a lock named ContosoSiteLock.
Parameters
-ApiVersion
Specifies the version of the resource provider API to use.
If you do not specify a version, this cmdlet uses the latest available version.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
Forces the command to run without asking for user confirmation.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LockId
Specifies the ID of the lock that this cmdlet modifies.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Id, ResourceId
Parameter sets
ByLockId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-LockLevel
Specifies the level for the lock.
Currently, the only valid value is CanNotDelete.
Parameter properties
Type: LockLevel
Default value: None
Accepted values: CanNotDelete, ReadOnly
Supports wildcards: False
DontShow: False
Aliases: Level
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-LockName
Specifies the name of the lock that this cmdlet modifies.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ExtensionResourceName, Name
Parameter sets
BySpecifiedScope
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ByResourceGroup
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ByResourceGroupLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
BySubscription
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
BySubscriptionLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-LockNotes
Specifies the notes for the lock.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Notes
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Pre
Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of the resource group for which the lock applies.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByResourceGroup
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ByResourceGroupLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ResourceName
Specifies the name of the resource for which the lock applies.
For instance, to specify a database, use the following format:
Server/
Database
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByResourceGroupLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
BySubscriptionLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ResourceType
Specifies the resource type for which the lock applies.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByResourceGroupLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
BySubscriptionLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Scope
Specifies the scope to which the lock applies.
For instance, to specify a database, use the following format:
/subscriptions/
subscription ID/resourceGroups/
resource group name/providers/Microsoft.Sql/servers/
server name/databases/
database name
To specify a resource group, use the following format:
/subscriptions/
subscription ID/resourceGroups/
resource group name
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
BySpecifiedScope
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs