`InvalidResourceName` when trying to deploy a model via the CLI to an existing resource

Tatiana Racheva 20 Reputation points
2024-07-10T03:07:52.9866667+00:00

Following this module: https://learn.microsoft.com/en-us/training/modules/get-started-openai/5-deploy-models

Note, this works fine in Azure OpenAI Studio. I only get errors when deploying using the CLI.

I'm running this command (not using my real resource name, but mine is also all lowercase letters, no symbols, numbers, etc.):

az cognitiveservices account deployment create -g my-openai-rg -n myresourcename --model-name gpt-35-turbo --model-version "0613" --model-format OpenAI --sku-name "Standard" --sku-capacity 1

The error is:

(InvalidResourceName) The resource name is invalid. Resource name can only include alphanumeric characters, underscores and hyphens; Resource name only allows 2 to 64 characters.

Code: InvalidResourceName

Message: The resource name is invalid. Resource name can only include alphanumeric characters, underscores and hyphens; Resource name only allows 2 to 64 characters.

The resource name is correct. When I tried using a resource name that doesn't exist, I get a different error.

Is this a bug?

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,645 questions
0 comments No comments
{count} votes

Accepted answer
  1. VarunTha 8,700 Reputation points Microsoft Vendor
    2024-07-11T16:38:08.0233333+00:00

    Hi Tatiana Racheva,
    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, Summarized and posted the solution that you shared, request you to Accept the answer, it will benefit the community find the answers quickly.

    Scenario: InvalidResourceName error when trying to deploy a model via the CLI to an existing resource.

    Issue: The deployment command fails with an InvalidResourceName error, despite the resource name being correct.

    Things Tried: Running the command without the --deployment-name parameter.

    Solution shared by @Tatiana Racheva

    Resolution: This worked: Adding the --deployment-name parameter to the command. This parameter is required to specify the name of the deployment.


1 additional answer

Sort by: Most helpful
  1. Tatiana Racheva 20 Reputation points
    2024-07-10T03:10:34.44+00:00

    Of course, as soon as I post it, I figure out the problem.

    The error message is wrong (again, nothing wrong with the resource name), but the error is legitimate. I was missing the --deployment-name parameter.

    Once I added it, the deployment was created.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.