Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
380 stars 192 forks source link

An error when creating work space #559

Open jwyin opened 5 years ago

jwyin commented 5 years ago

C# Code:

AzureCredentials credentials = SdkContext.AzureCredentialsFactory.FromFile("...");
            IAzure azure = Azure
                    .Configure()
                    .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                    .Authenticate(credentials)
                    .WithDefaultSubscription();
            Region region = Region.USEast2;
            IResourceGroup resourceGroup = null;
            if (azure.ResourceGroups.Contain("myResourceGroup"))
            {
                resourceGroup = azure.ResourceGroups.GetByName("myResourceGroup");
            }
            else
            {
                resourceGroup = azure
                    .ResourceGroups
                    .Define("myResourceGroup")
                    .WithRegion(region)
                    .Create();
            }

            IBatchAIWorkspace workspace = azure
                    .BatchAIWorkspaces
                    .Define("myworkspace")
                    .WithRegion(region)
                    .WithExistingResourceGroup(resourceGroup)
                    .Create();

Error message:

The resource type could not be found in the namespace 'Microsoft.BatchAI' for api version '2018-05-01'.
StackTrace:
   at Microsoft.Azure.Management.BatchAI.Fluent.WorkspacesOperations.<BeginCreateWithHttpMessagesAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.BatchAI.Fluent.WorkspacesOperations.<CreateWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.BatchAI.Fluent.WorkspacesOperationsExtensions.<CreateAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.BatchAI.Fluent.BatchAIWorkspaceImpl.<CreateResourceAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.Extensions.Synchronize[TResult](Func`1 function)
   at Colosseum.BatchAI.Program.Main(String[] args) in D:\Projects\Colosseum\Colosseum.BatchAI\Program.cs:line 35
praries880 commented 5 years ago

@jwyin Can you follow the sample as described here and see if it works for you?

If not, what are the versions of the SDK and the client runtime you are using?