A Maps API-khoz használható elsődleges vagy másodlagos kulcs újragenerálása. A régi kulcs azonnal leáll.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/regenerateKey?api-version=2023-06-01
URI-paraméterek
Name |
In |
Kötelező |
Típus |
Description |
accountName
|
path |
True
|
string
|
A Maps-fiók neve.
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Az erőforráscsoport neve. A név nem megkülönbözteti a kis- és nagybetűket.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
A cél-előfizetés azonosítója.
|
api-version
|
query |
True
|
string
minLength: 1
|
A művelethez használni kívánt API-verzió.
|
Kérelem törzse
Name |
Kötelező |
Típus |
Description |
keyType
|
True
|
KeyType
|
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
|
Válaszok
Biztonság
azure_auth
Azure Active Directory OAuth2 Flow
Típus:
oauth2
Folyamat:
implicit
Engedélyezési URL:
https://login.microsoftonline.com/common/oauth2/authorize
Hatókörök
Name |
Description |
user_impersonation
|
a felhasználói fiók megszemélyesítése
|
Példák
Regenerate Key
Mintakérelem
POST https://management.azure.com/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Maps/accounts/myMapsAccount/regenerateKey?api-version=2023-06-01
{
"keyType": "primary"
}
import com.azure.resourcemanager.maps.models.KeyType;
import com.azure.resourcemanager.maps.models.MapsKeySpecification;
/**
* Samples for Accounts RegenerateKeys.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json
*/
/**
* Sample code: Regenerate Key.
*
* @param manager Entry point to AzureMapsManager.
*/
public static void regenerateKey(com.azure.resourcemanager.maps.AzureMapsManager manager) {
manager.accounts().regenerateKeysWithResponse("myResourceGroup", "myMapsAccount",
new MapsKeySpecification().withKeyType(KeyType.PRIMARY), com.azure.core.util.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.maps import AzureMapsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-maps
# USAGE
python regenerate_key.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 = AzureMapsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="21a9967a-e8a9-4656-a70b-96ff1c4d05a0",
)
response = client.accounts.regenerate_keys(
resource_group_name="myResourceGroup",
account_name="myMapsAccount",
key_specification={"keyType": "primary"},
)
print(response)
# x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.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
package armmaps_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maps/armmaps"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b9403296f0b0e112b0d8222ad05fd1d79ee10e03/specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json
func ExampleAccountsClient_RegenerateKeys() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmaps.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAccountsClient().RegenerateKeys(ctx, "myResourceGroup", "myMapsAccount", armmaps.KeySpecification{
KeyType: to.Ptr(armmaps.KeyTypePrimary),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AccountKeys = armmaps.AccountKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// PrimaryKeyLastUpdated: to.Ptr("2021-07-02T01:01:01.1075056Z"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// SecondaryKeyLastUpdated: to.Ptr("2021-07-02T01:01:01.1075056Z"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMapsManagementClient } = require("@azure/arm-maps");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working immediately.
*
* @summary Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working immediately.
* x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json
*/
async function regenerateKey() {
const subscriptionId =
process.env["MAPS_SUBSCRIPTION_ID"] || "21a9967a-e8a9-4656-a70b-96ff1c4d05a0";
const resourceGroupName = process.env["MAPS_RESOURCE_GROUP"] || "myResourceGroup";
const accountName = "myMapsAccount";
const keySpecification = { keyType: "primary" };
const credential = new DefaultAzureCredential();
const client = new AzureMapsManagementClient(credential, subscriptionId);
const result = await client.accounts.regenerateKeys(
resourceGroupName,
accountName,
keySpecification
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Maps.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Maps;
// Generated from example definition: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json
// this example is just showing the usage of "Accounts_RegenerateKeys" 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 MapsAccountResource created on azure
// for more information of creating MapsAccountResource, please refer to the document of MapsAccountResource
string subscriptionId = "21a9967a-e8a9-4656-a70b-96ff1c4d05a0";
string resourceGroupName = "myResourceGroup";
string accountName = "myMapsAccount";
ResourceIdentifier mapsAccountResourceId = MapsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
MapsAccountResource mapsAccount = client.GetMapsAccountResource(mapsAccountResourceId);
// invoke the operation
MapsKeySpecification keySpecification = new MapsKeySpecification(MapsKeyType.Primary);
MapsAccountKeys result = await mapsAccount.RegenerateKeysAsync(keySpecification);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Mintaválasz
{
"primaryKey": "<primaryKey>",
"primaryKeyLastUpdated": "2021-07-02T01:01:01.1075056Z",
"secondaryKey": "<secondaryKey>",
"secondaryKeyLastUpdated": "2021-07-02T01:01:01.1075056Z"
}
Definíciók
Name |
Description |
ErrorAdditionalInfo
|
Az erőforrás-kezelési hiba további információi.
|
ErrorDetail
|
A hiba részletei.
|
ErrorResponse
|
Hibaválasz
|
KeyType
|
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
|
MapsAccountKeys
|
A Maps REST API-k eléréséhez használható kulcsok készlete. A kulcsok megszakítás nélküli forgatásához két kulcs van megadva.
|
MapsKeySpecification
|
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
|
ErrorAdditionalInfo
Objektum
Az erőforrás-kezelési hiba további információi.
Name |
Típus |
Description |
info
|
object
|
A további információk.
|
type
|
string
|
A további információtípus.
|
ErrorDetail
Objektum
A hiba részletei.
Name |
Típus |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
A hiba további információi.
|
code
|
string
|
A hibakód.
|
details
|
ErrorDetail[]
|
A hiba részletei.
|
message
|
string
|
A hibaüzenet.
|
target
|
string
|
A hibacél.
|
ErrorResponse
Objektum
Hibaválasz
Name |
Típus |
Description |
error
|
ErrorDetail
|
A hibaobjektum.
|
KeyType
Enumerálás
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
Érték |
Description |
primary
|
|
secondary
|
|
MapsAccountKeys
Objektum
A Maps REST API-k eléréséhez használható kulcsok készlete. A kulcsok megszakítás nélküli forgatásához két kulcs van megadva.
Name |
Típus |
Description |
primaryKey
|
string
|
A Maps REST API-k elérésének elsődleges kulcsa.
|
primaryKeyLastUpdated
|
string
|
Az elsődleges kulcs utolsó frissített dátuma és időpontja.
|
secondaryKey
|
string
|
A Maps REST API-k elérésének másodlagos kulcsa.
|
secondaryKeyLastUpdated
|
string
|
A másodlagos kulcs utolsó frissített dátuma és időpontja.
|
MapsKeySpecification
Objektum
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
Name |
Típus |
Description |
keyType
|
KeyType
|
Azt jelzi, hogy a művelet az elsődleges vagy a másodlagos kulcsra vonatkozik-e.
|