Abrufen einer Verwaltungssperre nach Bereich.
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/locks/{lockName}?api-version=2016-09-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
lockName
|
path |
True
|
string
|
Der Name der Sperre.
|
scope
|
path |
True
|
string
|
Der Bereich für die Sperre.
|
api-version
|
query |
True
|
string
|
Die API-Version, die für den Vorgang verwendet werden soll.
|
Antworten
Sicherheit
azure_auth
Azure Active Directory-OAuth2-Flow
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel Ihres Benutzerkontos
|
Beispiele
Get management lock at scope
Beispielanforderung
GET https://management.azure.com/subscriptions/subscriptionId/providers/Microsoft.Authorization/locks/testlock?api-version=2016-09-01
import com.azure.core.util.Context;
/** Samples for ManagementLocks GetByScope. */
public final class Main {
/*
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.json
*/
/**
* Sample code: Get management lock at scope.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getManagementLockAtScope(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.genericResources()
.manager()
.managementLockClient()
.getManagementLocks()
.getByScopeWithResponse("subscriptions/subscriptionId", "testlock", 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.resource import ManagementLockClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource
# USAGE
python management_locks_get_at_scope.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 = ManagementLockClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.management_locks.get_by_scope(
scope="subscriptions/subscriptionId",
lock_name="testlock",
)
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.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
const { ManagementLockClient } = require("@azure/arm-locks-profile-2020-09-01-hybrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Get a management lock by scope.
*
* @summary Get a management lock by scope.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.json
*/
async function getManagementLockAtScope() {
const subscriptionId =
process.env["LOCKS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope = "subscriptions/subscriptionId";
const lockName = "testlock";
const credential = new DefaultAzureCredential();
const client = new ManagementLockClient(credential, subscriptionId);
const result = await client.managementLocks.getByScope(scope, lockName);
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
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
// Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.json
// this example is just showing the usage of "ManagementLocks_GetByScope" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this ManagementLockResource
string scope = "subscriptions/subscriptionId";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
ManagementLockCollection collection = client.GetGenericResource(scopeId).GetManagementLocks();
// invoke the operation
string lockName = "testlock";
NullableResponse<ManagementLockResource> response = await collection.GetIfExistsAsync(lockName);
ManagementLockResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagementLockData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"properties": {
"level": "ReadOnly"
},
"id": "/providers/Microsoft.Authorization/locks/testlock",
"type": "Microsoft.Authorization/locks",
"name": "testlock"
}
Definitionen
Name |
Beschreibung |
LockLevel
|
Die Ebene der Sperre. Mögliche Werte sind: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete bedeutet, dass autorisierte Benutzer in der Lage sind, die Ressourcen zu lesen und zu ändern, aber nicht zu löschen. ReadOnly bedeutet, dass autorisierte Benutzer nur aus einer Ressource lesen, aber nicht ändern oder löschen können.
|
ManagementLockObject
|
Die Sperrinformationen.
|
ManagementLockOwner
|
Eigenschaften des Besitzers sperren.
|
LockLevel
Die Ebene der Sperre. Mögliche Werte sind: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete bedeutet, dass autorisierte Benutzer in der Lage sind, die Ressourcen zu lesen und zu ändern, aber nicht zu löschen. ReadOnly bedeutet, dass autorisierte Benutzer nur aus einer Ressource lesen, aber nicht ändern oder löschen können.
Name |
Typ |
Beschreibung |
CanNotDelete
|
string
|
|
NotSpecified
|
string
|
|
ReadOnly
|
string
|
|
ManagementLockObject
Die Sperrinformationen.
Name |
Typ |
Beschreibung |
id
|
string
|
Die Ressourcen-ID der Sperre.
|
name
|
string
|
Der Name der Sperre.
|
properties.level
|
LockLevel
|
Die Ebene der Sperre. Mögliche Werte sind: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete bedeutet, dass autorisierte Benutzer in der Lage sind, die Ressourcen zu lesen und zu ändern, aber nicht zu löschen. ReadOnly bedeutet, dass autorisierte Benutzer nur aus einer Ressource lesen, aber nicht ändern oder löschen können.
|
properties.notes
|
string
|
Hinweise zur Sperre. Maximal 512 Zeichen.
|
properties.owners
|
ManagementLockOwner[]
|
Die Besitzer der Sperre.
|
type
|
string
|
Der Ressourcentyp der Sperre: Microsoft.Authorization/locks.
|
ManagementLockOwner
Eigenschaften des Besitzers sperren.
Name |
Typ |
Beschreibung |
applicationId
|
string
|
Die Anwendungs-ID des Sperrbesitzers.
|