Utwórz projekt konta usług Cognitive Services. Project to zasób podrzędny konta, który daje programiście AI indywidualny kontener do pracy.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}?api-version=2025-06-01
Parametry identyfikatora URI
| Nazwa |
W |
Wymagane |
Typ |
Opis |
|
accountName
|
path |
True
|
string
minLength: 2 maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
|
Nazwa konta usług Cognitive Services.
|
|
projectName
|
path |
True
|
string
minLength: 2 maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
|
Nazwa projektu konta usług Cognitive Services.
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
Identyfikator subskrypcji docelowej.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Wersja interfejsu API do użycia dla tej operacji.
|
Treść żądania
| Nazwa |
Typ |
Opis |
|
identity
|
Identity
|
Tożsamość zasobu.
|
|
location
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
|
properties
|
ProjectProperties
|
Właściwości projektu usług Cognitive Services.
|
|
tags
|
object
|
Tagi zasobów.
|
Odpowiedzi
| Nazwa |
Typ |
Opis |
|
200 OK
|
Project
|
Jeśli zasób został utworzony pomyślnie lub już istnieje, usługa powinna zwrócić wartość 200 (OK).
|
|
201 Created
|
Project
|
Jeśli zasób zostanie utworzony pomyślnie, usługa powinna zwrócić wartość 201 (OK).
|
|
202 Accepted
|
Project
|
HTTP 202 (zaakceptowane), jeśli operacja została pomyślnie uruchomiona i zostanie ukończona asynchronicznie.
|
|
Other Status Codes
|
ErrorResponse
|
Odpowiedź o błędzie opisująca, dlaczego operacja nie powiodła się
|
Przykłady
Create Project
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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"
}
}
Definicje
createdByType
Wyliczenie
Typ tożsamości, która utworzyła zasób.
| Wartość |
Opis |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objekt
Dodatkowe informacje o błędzie zarządzania zasobami.
| Nazwa |
Typ |
Opis |
|
info
|
object
|
Dodatkowe informacje.
|
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Objekt
Szczegóły błędu.
| Nazwa |
Typ |
Opis |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Błąd dodatkowe informacje.
|
|
code
|
string
|
Kod błędu.
|
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
|
message
|
string
|
Komunikat o błędzie.
|
|
target
|
string
|
Wartość docelowa błędu.
|
ErrorResponse
Objekt
Odpowiedź na błąd
Identity
Objekt
Tożsamość zasobu.
| Nazwa |
Typ |
Opis |
|
principalId
|
string
|
Identyfikator podmiotu zabezpieczeń tożsamości zasobu.
|
|
tenantId
|
string
|
Identyfikator dzierżawy zasobu.
|
|
type
|
ResourceIdentityType
|
Typ tożsamości.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
Lista tożsamości przypisanych przez użytkownika skojarzonych z zasobem. Odwołania do klucza słownika tożsamości użytkownika będą identyfikatorami zasobów usługi ARM w postaci: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
|
Project
Objekt
Projekt usług Cognitive Services to zasób platformy Azure reprezentujący projekt aprowizowanego konta, jego typ, lokalizację i jednostkę SKU.
| Nazwa |
Typ |
Opis |
|
etag
|
string
|
Zasób Etag.
|
|
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
Identity
|
Tożsamość zasobu.
|
|
location
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
|
name
|
string
|
Nazwa zasobu
|
|
properties
|
ProjectProperties
|
Właściwości projektu usług Cognitive Services.
|
|
systemData
|
systemData
|
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
|
|
tags
|
object
|
Tagi zasobów.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
ProjectProperties
Objekt
Właściwości projektu Cognitive Services".
| Nazwa |
Typ |
Opis |
|
description
|
string
|
Opis projektu usług Cognitive Services.
|
|
displayName
|
string
|
Nazwa wyświetlana projektu usług Cognitive Services.
|
|
endpoints
|
object
|
Lista punktów końcowych dla tego projektu usług Cognitive Services.
|
|
isDefault
|
boolean
|
Wskazuje, czy projekt jest projektem domyślnym dla konta.
|
|
provisioningState
|
ProvisioningState
|
Pobiera stan projektu usług Cognitive Services w momencie wywołania operacji.
|
ProvisioningState
Wyliczenie
Pobiera stan konta usług Cognitive Services w momencie wywołania operacji.
| Wartość |
Opis |
|
Accepted
|
|
|
Creating
|
|
|
Deleting
|
|
|
Moving
|
|
|
Failed
|
|
|
Succeeded
|
|
|
ResolvingDNS
|
|
ResourceIdentityType
Wyliczenie
Typ tożsamości.
| Wartość |
Opis |
|
None
|
|
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned, UserAssigned
|
|
systemData
Objekt
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
| Nazwa |
Typ |
Opis |
|
createdAt
|
string
(date-time)
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
lastModifiedAt
|
string
(date-time)
|
Znacznik czasu ostatniej modyfikacji zasobu (UTC)
|
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|
UserAssignedIdentity
Objekt
Tożsamość zarządzana przypisana przez użytkownika.
| Nazwa |
Typ |
Opis |
|
clientId
|
string
|
Identyfikator aplikacji klienta skojarzony z tą tożsamością.
|
|
principalId
|
string
|
Identyfikator podmiotu zabezpieczeń usługi Azure Active Directory skojarzony z tą tożsamością.
|