Checks whether the specified account name is available or taken.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability?api-version=2016-11-01
URI Parameters
Name
In
Required
Type
Description
location
path
True
string
The resource location without whitespace.
subscriptionId
path
True
string
Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
api-version
query
True
string
Client Api Version.
Request Body
Name
Required
Type
Description
name
True
string
The Data Lake Store name to check availability for.
type
True
enum:
Microsoft.DataLakeStore/accounts
The resource type. Note: This should not be set by the user, as the constant value is Microsoft.DataLakeStore/accounts
POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.DataLakeStore/locations/EastUS2/checkNameAvailability?api-version=2016-11-01
{
"name": "contosoadla",
"type": "Microsoft.DataLakeStore/accounts"
}
import com.azure.resourcemanager.datalakestore.models.CheckNameAvailabilityParameters;
/**
* Samples for Accounts CheckNameAvailability.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/
* Accounts_CheckNameAvailability.json
*/
/**
* Sample code: Checks whether the specified account name is available or taken.
*
* @param manager Entry point to DataLakeStoreManager.
*/
public static void checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken(
com.azure.resourcemanager.datalakestore.DataLakeStoreManager manager) {
manager.accounts().checkNameAvailabilityWithResponse("EastUS2",
new CheckNameAvailabilityParameters().withName("contosoadla"), com.azure.core.util.Context.NONE);
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-datalake-store
# USAGE
python accounts_check_name_availability.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 = DataLakeStoreAccountManagementClient(
credential=DefaultAzureCredential(),
subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
response = client.accounts.check_name_availability(
location="EastUS2",
parameters={"name": "contosoadla", "type": "Microsoft.DataLakeStore/accounts"},
)
print(response)
# x-ms-original-file: specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_CheckNameAvailability.json
if __name__ == "__main__":
main()
package armdatalakestore_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/datalake-store/armdatalakestore"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/datalake-store/resource-manager/Microsoft.DataLakeStore/stable/2016-11-01/examples/Accounts_CheckNameAvailability.json
func ExampleAccountsClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdatalakestore.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAccountsClient().CheckNameAvailability(ctx, "EastUS2", armdatalakestore.CheckNameAvailabilityParameters{
Name: to.Ptr("contosoadla"),
Type: to.Ptr(armdatalakestore.CheckNameAvailabilityParametersTypeMicrosoftDataLakeStoreAccounts),
}, 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.NameAvailabilityInformation = armdatalakestore.NameAvailabilityInformation{
// Message: to.Ptr("An account named 'abc' already exists."),
// NameAvailable: to.Ptr(false),
// Reason: to.Ptr("AlreadyExists"),
// }
}