Skapa Cognitive Services-kontots projekt. Project är en underresurs till ett konto som ger AI-utvecklaren en individuell behållare att arbeta med.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}?api-version=2025-06-01
URI-parametrar
| Name |
I |
Obligatorisk |
Typ |
Description |
|
accountName
|
path |
True
|
string
minLength: 2 maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
|
Namnet på Cognitive Services-kontot.
|
|
projectName
|
path |
True
|
string
minLength: 2 maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
|
Namnet på Cognitive Services-kontots projekt.
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Namnet på resursgruppen. Namnet är skiftlägesokänsligt.
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
ID för målprenumerationen.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Den API-version som ska användas för den här åtgärden.
|
Begärandetext
| Name |
Typ |
Description |
|
identity
|
Identity
|
Identitet för resursen.
|
|
location
|
string
|
Den geo-plats där resursen finns
|
|
properties
|
ProjectProperties
|
Egenskaper för Cognitive Services-projektet.
|
|
tags
|
object
|
Resursetiketter.
|
Svar
| Name |
Typ |
Description |
|
200 OK
|
Project
|
Om resursen har skapats eller redan finns ska tjänsten returnera 200 (OK).
|
|
201 Created
|
Project
|
Om resursen har skapats ska tjänsten returnera 201 (OK).
|
|
202 Accepted
|
Project
|
HTTP 202 (accepterad) om åtgärden har startats och kommer att slutföras asynkront.
|
|
Other Status Codes
|
ErrorResponse
|
Felsvar som beskriver varför åtgärden misslyckades
|
Exempel
Create Project
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1?api-version=2025-06-01
{
"location": "West US",
"properties": {
"description": "Description of this project",
"displayName": "p1"
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.cognitiveservices.models.Identity;
import com.azure.resourcemanager.cognitiveservices.models.ProjectProperties;
import com.azure.resourcemanager.cognitiveservices.models.ResourceIdentityType;
/**
* Samples for Projects Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/
* CreateProject.json
*/
/**
* Sample code: Create Project.
*
* @param manager Entry point to CognitiveServicesManager.
*/
public static void createProject(com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager manager) {
manager.projects().define("testProject1").withExistingAccount("myResourceGroup", "testCreate1")
.withRegion("West US").withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(
new ProjectProperties().withDisplayName("p1").withDescription("Description of this project"))
.create();
}
}
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.cognitiveservices import CognitiveServicesManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cognitiveservices
# USAGE
python create_project.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 = CognitiveServicesManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)
response = client.projects.begin_create(
resource_group_name="myResourceGroup",
account_name="testCreate1",
project_name="testProject1",
project={
"identity": {"type": "SystemAssigned"},
"location": "West US",
"properties": {"description": "Description of this project", "displayName": "p1"},
},
).result()
print(response)
# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProject.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 armcognitiveservices_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/cognitiveservices/armcognitiveservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1004eed4202d64b48157c084fe2830760f8190f4/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProject.json
func ExampleProjectsClient_BeginCreate_createProject() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcognitiveservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewProjectsClient().BeginCreate(ctx, "myResourceGroup", "testCreate1", "testProject1", armcognitiveservices.Project{
Identity: &armcognitiveservices.Identity{
Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned),
},
Location: to.Ptr("West US"),
Properties: &armcognitiveservices.ProjectProperties{
Description: to.Ptr("Description of this project"),
DisplayName: to.Ptr("p1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Project = armcognitiveservices.Project{
// Name: to.Ptr("testProject1"),
// Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"),
// ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1"),
// Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""),
// Identity: &armcognitiveservices.Identity{
// Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("b5cf119e-a5c2-42c7-802f-592e0efb169f"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// Location: to.Ptr("West US"),
// Properties: &armcognitiveservices.ProjectProperties{
// Description: to.Ptr("Description of this project"),
// DisplayName: to.Ptr("p1"),
// Endpoints: map[string]*string{
// "OpenAI Dall-E API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// "OpenAI Language Model Instance API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// "OpenAI Sora API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// },
// IsDefault: to.Ptr(true),
// ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer it's individual container to work on.
*
* @summary Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer it's individual container to work on.
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProject.json
*/
async function createProject() {
const subscriptionId =
process.env["COGNITIVESERVICES_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444";
const resourceGroupName = process.env["COGNITIVESERVICES_RESOURCE_GROUP"] || "myResourceGroup";
const accountName = "testCreate1";
const projectName = "testProject1";
const project = {
identity: { type: "SystemAssigned" },
location: "West US",
properties: {
description: "Description of this project",
displayName: "p1",
},
};
const credential = new DefaultAzureCredential();
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
const result = await client.projects.beginCreateAndWait(
resourceGroupName,
accountName,
projectName,
project,
);
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.CognitiveServices.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.CognitiveServices;
// Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProject.json
// this example is just showing the usage of "Projects_Create" 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 CognitiveServicesAccountResource created on azure
// for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "myResourceGroup";
string accountName = "testCreate1";
ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId);
// get the collection of this CognitiveServicesProjectResource
CognitiveServicesProjectCollection collection = cognitiveServicesAccount.GetCognitiveServicesProjects();
// invoke the operation
string projectName = "testProject1";
CognitiveServicesProjectData data = new CognitiveServicesProjectData(new AzureLocation("West US"))
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
Properties = new CognitiveServicesProjectProperties
{
DisplayName = "p1",
Description = "Description of this project",
},
};
ArmOperation<CognitiveServicesProjectResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, projectName, data);
CognitiveServicesProjectResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CognitiveServicesProjectData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\"",
"properties": {
"description": "Description of this project",
"displayName": "p1",
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"description": "Description of this project",
"displayName": "p1",
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"description": "Description of this project",
"displayName": "p1",
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
Create Project Min
Exempelbegäran
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1?api-version=2025-06-01
{
"location": "West US",
"properties": {},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.cognitiveservices.models.Identity;
import com.azure.resourcemanager.cognitiveservices.models.ProjectProperties;
import com.azure.resourcemanager.cognitiveservices.models.ResourceIdentityType;
/**
* Samples for Projects Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/
* CreateProjectMin.json
*/
/**
* Sample code: Create Project Min.
*
* @param manager Entry point to CognitiveServicesManager.
*/
public static void createProjectMin(com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager manager) {
manager.projects().define("testProject1").withExistingAccount("myResourceGroup", "testCreate1")
.withRegion("West US").withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(new ProjectProperties()).create();
}
}
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.cognitiveservices import CognitiveServicesManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cognitiveservices
# USAGE
python create_project_min.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 = CognitiveServicesManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)
response = client.projects.begin_create(
resource_group_name="myResourceGroup",
account_name="testCreate1",
project_name="testProject1",
project={"identity": {"type": "SystemAssigned"}, "location": "West US", "properties": {}},
).result()
print(response)
# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProjectMin.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 armcognitiveservices_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/cognitiveservices/armcognitiveservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1004eed4202d64b48157c084fe2830760f8190f4/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProjectMin.json
func ExampleProjectsClient_BeginCreate_createProjectMin() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcognitiveservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewProjectsClient().BeginCreate(ctx, "myResourceGroup", "testCreate1", "testProject1", armcognitiveservices.Project{
Identity: &armcognitiveservices.Identity{
Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned),
},
Location: to.Ptr("West US"),
Properties: &armcognitiveservices.ProjectProperties{},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Project = armcognitiveservices.Project{
// Name: to.Ptr("testProject1"),
// Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"),
// ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1"),
// Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""),
// Identity: &armcognitiveservices.Identity{
// Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("b5cf119e-a5c2-42c7-802f-592e0efb169f"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// Location: to.Ptr("West US"),
// Properties: &armcognitiveservices.ProjectProperties{
// Endpoints: map[string]*string{
// "OpenAI Dall-E API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// "OpenAI Language Model Instance API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// "OpenAI Sora API": to.Ptr("https://sub-donmain-name.openai.azure.com/"),
// },
// IsDefault: to.Ptr(true),
// ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer it's individual container to work on.
*
* @summary Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer it's individual container to work on.
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProjectMin.json
*/
async function createProjectMin() {
const subscriptionId =
process.env["COGNITIVESERVICES_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444";
const resourceGroupName = process.env["COGNITIVESERVICES_RESOURCE_GROUP"] || "myResourceGroup";
const accountName = "testCreate1";
const projectName = "testProject1";
const project = {
identity: { type: "SystemAssigned" },
location: "West US",
properties: {},
};
const credential = new DefaultAzureCredential();
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
const result = await client.projects.beginCreateAndWait(
resourceGroupName,
accountName,
projectName,
project,
);
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.CognitiveServices.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.CognitiveServices;
// Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateProjectMin.json
// this example is just showing the usage of "Projects_Create" 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 CognitiveServicesAccountResource created on azure
// for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "myResourceGroup";
string accountName = "testCreate1";
ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId);
// get the collection of this CognitiveServicesProjectResource
CognitiveServicesProjectCollection collection = cognitiveServicesAccount.GetCognitiveServicesProjects();
// invoke the operation
string projectName = "testProject1";
CognitiveServicesProjectData data = new CognitiveServicesProjectData(new AzureLocation("West US"))
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
Properties = new CognitiveServicesProjectProperties(),
};
ArmOperation<CognitiveServicesProjectResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, projectName, data);
CognitiveServicesProjectResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CognitiveServicesProjectData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1/projects/testProject1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\"",
"properties": {
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testProject1",
"type": "Microsoft.CognitiveServices/accounts/projects",
"location": "West US",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"provisioningState": "Succeeded",
"endpoints": {
"OpenAI Language Model Instance API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Dall-E API": "https://sub-donmain-name.openai.azure.com/",
"OpenAI Sora API": "https://sub-donmain-name.openai.azure.com/"
},
"isDefault": true
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
Definitioner
createdByType
Uppräkning
Den typ av identitet som skapade resursen.
| Värde |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objekt
Ytterligare information om resurshanteringsfelet.
| Name |
Typ |
Description |
|
info
|
object
|
Den ytterligare informationen.
|
|
type
|
string
|
Typen av ytterligare information.
|
ErrorDetail
Objekt
Felinformationen.
| Name |
Typ |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Felet ytterligare information.
|
|
code
|
string
|
Felkoden.
|
|
details
|
ErrorDetail[]
|
Information om felet.
|
|
message
|
string
|
Felmeddelandet.
|
|
target
|
string
|
Felet riktas.
|
ErrorResponse
Objekt
Felsvar
Identity
Objekt
Identitet för resursen.
| Name |
Typ |
Description |
|
principalId
|
string
|
Huvud-ID för resursidentiteten.
|
|
tenantId
|
string
|
Klientorganisations-ID för resursen.
|
|
type
|
ResourceIdentityType
|
Identitetstypen.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
Listan över användartilldelade identiteter som är associerade med resursen. Nyckelreferenserna för användaridentitetsordlistan är ARM-resurs-ID:t i formuläret: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
|
Project
Objekt
Cognitive Services-projektet är en Azure-resurs som representerar det etablerade kontots projekt, dess typ, plats och SKU.
| Name |
Typ |
Description |
|
etag
|
string
|
Resurs-Etag.
|
|
id
|
string
|
Fullständigt kvalificerat resurs-ID för resursen. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
Identity
|
Identitet för resursen.
|
|
location
|
string
|
Den geo-plats där resursen finns
|
|
name
|
string
|
Namnet på resursen
|
|
properties
|
ProjectProperties
|
Egenskaper för Cognitive Services-projektet.
|
|
systemData
|
systemData
|
Metadata som rör skapande och senaste ändring av resursen.
|
|
tags
|
object
|
Resursetiketter.
|
|
type
|
string
|
Resurstypen. T.ex. "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"
|
ProjectProperties
Objekt
Egenskaper för Cognitive Services-projektet".
| Name |
Typ |
Description |
|
description
|
string
|
Beskrivningen av Cognitive Services-projektet.
|
|
displayName
|
string
|
Visningsnamnet för Cognitive Services-projektet.
|
|
endpoints
|
object
|
Listan över slutpunkter för det här Cognitive Services-projektet.
|
|
isDefault
|
boolean
|
Anger om projektet är standardprojektet för kontot.
|
|
provisioningState
|
ProvisioningState
|
Hämtar status för cognitive services-projektet vid den tidpunkt då åtgärden anropades.
|
ProvisioningState
Uppräkning
Hämtar status för cognitive services-kontot när åtgärden anropades.
| Värde |
Description |
|
Accepted
|
|
|
Creating
|
|
|
Deleting
|
|
|
Moving
|
|
|
Failed
|
|
|
Succeeded
|
|
|
ResolvingDNS
|
|
ResourceIdentityType
Uppräkning
Identitetstypen.
| Värde |
Description |
|
None
|
|
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned, UserAssigned
|
|
systemData
Objekt
Metadata som rör skapande och senaste ändring av resursen.
| Name |
Typ |
Description |
|
createdAt
|
string
(date-time)
|
Tidsstämpeln för att skapa resurser (UTC).
|
|
createdBy
|
string
|
Identiteten som skapade resursen.
|
|
createdByType
|
createdByType
|
Den typ av identitet som skapade resursen.
|
|
lastModifiedAt
|
string
(date-time)
|
Tidsstämpeln för senaste ändring av resurs (UTC)
|
|
lastModifiedBy
|
string
|
Identiteten som senast ändrade resursen.
|
|
lastModifiedByType
|
createdByType
|
Den typ av identitet som senast ändrade resursen.
|
UserAssignedIdentity
Objekt
Användartilldelad hanterad identitet.
| Name |
Typ |
Description |
|
clientId
|
string
|
Klientapp-ID som är associerat med den här identiteten.
|
|
principalId
|
string
|
Azure Active Directory huvudnamns-ID som är associerat med den här identiteten.
|