Microsoft.Azure.Commands.Batch.Models.BatchClient.RegenerateKeys C# (CSharp) Method

RegenerateKeys() public method

Generates new key for the Batch account
public RegenerateKeys ( string resourceGroupName, string accountName, AccountKeyType keyType ) : BatchAccountContext
resourceGroupName string The name of the resource group the account is under. If unspecified, it will be looked up.
accountName string The account name
keyType AccountKeyType The type of key to regenerate
return BatchAccountContext
        public virtual BatchAccountContext RegenerateKeys(string resourceGroupName, string accountName, AccountKeyType keyType)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                // use resource mgr to see if account exists and then use resource group name to do the actual lookup
                resourceGroupName = GetGroupForAccount(accountName);
            }

            var regenResponse = BatchManagementClient.BatchAccount.RegenerateKey(resourceGroupName, accountName, keyType);

            var context = GetAccount(resourceGroupName, accountName);
            context.PrimaryAccountKey = regenResponse.Primary;
            context.SecondaryAccountKey = regenResponse.Secondary;

            // build a new context to put the keys into
            return context;
        }
BatchClient