Named Value - Create Or Update

建立或更新具名值。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}?api-version=2022-08-01

URI 參數

名稱 位於 必要 類型 Description
namedValueId
path True

string

NamedValue 的標識碼。

Regex pattern: ^[^*#&+:<>?]+$

resourceGroupName
path True

string

資源群組的名稱。 名稱不區分大小寫。

serviceName
path True

string

API 管理 服務的名稱。

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

目標訂用帳戶的標識碼。

api-version
query True

string

用於此作業的 API 版本。

要求標頭

名稱 必要 類型 Description
If-Match

string

實體的 ETag。 建立實體時不需要,但在更新實體時則為必要專案。

要求本文

名稱 必要 類型 Description
properties.displayName True

string

NamedValue 的唯一名稱。 只能包含字母、數字、句點、破折號和底線字元。

properties.keyVault

KeyVaultContractCreateProperties

namedValue的KeyVault位置詳細數據。

properties.secret

boolean

決定該值是否為密碼且是否應該加密。 預設值為 False。

properties.tags

string[]

選擇性標記,當提供時可用來篩選 NamedValue 清單。

properties.value

string

NamedValue 的值。 可以包含原則表達式。 不能是空白或只由空白字元組成。 此屬性不會填入 『GET』 作業! 使用 '/listSecrets' POST 要求來取得值。

回應

名稱 類型 Description
200 OK

NamedValueContract

已成功更新具名值。

Headers

ETag: string

201 Created

NamedValueContract

已成功建立具名值。

Headers

ETag: string

202 Accepted

已接受建立或更新具名值的要求。

Other Status Codes

ErrorResponse

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

ApiManagementCreateNamedValue
ApiManagementCreateNamedValueWithKeyVault

ApiManagementCreateNamedValue

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2?api-version=2022-08-01

{
  "properties": {
    "displayName": "prop3name",
    "value": "propValue",
    "tags": [
      "foo",
      "bar"
    ],
    "secret": false
  }
}

Sample Response

location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2",
  "type": "Microsoft.ApiManagement/service/namedValues",
  "name": "testprop2",
  "properties": {
    "displayName": "prop3name",
    "value": "propValue",
    "tags": [
      "foo",
      "bar"
    ],
    "secret": false
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2",
  "type": "Microsoft.ApiManagement/service/namedValues",
  "name": "testprop2",
  "properties": {
    "displayName": "prop3name",
    "value": "propValue",
    "tags": [
      "foo",
      "bar"
    ],
    "secret": false
  }
}

ApiManagementCreateNamedValueWithKeyVault

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6?api-version=2022-08-01

{
  "properties": {
    "displayName": "prop6namekv",
    "keyVault": {
      "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
      "secretIdentifier": "https://contoso.vault.azure.net/secrets/aadSecret"
    },
    "tags": [
      "foo",
      "bar"
    ],
    "secret": true
  }
}

Sample Response

location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6",
  "type": "Microsoft.ApiManagement/service/namedValues",
  "name": "testprop6",
  "properties": {
    "displayName": "prop6namekv",
    "keyVault": {
      "secretIdentifier": "https://contoso.vault.azure.net/secrets/aadSecret",
      "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
      "lastStatus": {
        "code": "Success",
        "timeStampUtc": "2020-09-11T00:54:31.8024882Z"
      }
    },
    "tags": [
      "foo",
      "bar"
    ],
    "secret": true
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6",
  "type": "Microsoft.ApiManagement/service/namedValues",
  "name": "testprop6",
  "properties": {
    "displayName": "prop6namekv",
    "keyVault": {
      "secretIdentifier": "https://contoso.vault.azure.net/secrets/aadSecret",
      "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
      "lastStatus": {
        "code": "Success",
        "timeStampUtc": "2020-09-11T00:54:31.8024882Z"
      }
    },
    "tags": [
      "foo",
      "bar"
    ],
    "secret": true
  }
}

定義

名稱 Description
ErrorFieldContract

錯誤欄位合約。

ErrorResponse

錯誤回應。

KeyVaultContractCreateProperties

建立keyVault合約詳細數據。

KeyVaultContractProperties

KeyVault 合約詳細數據。

KeyVaultLastAccessStatusContractProperties

發出合約更新屬性。

NamedValueContract

NamedValue 詳細數據。

NamedValueCreateContract

NamedValue 詳細數據。

ErrorFieldContract

錯誤欄位合約。

名稱 類型 Description
code

string

屬性層級錯誤碼。

message

string

人類可讀取的屬性層級錯誤表示法。

target

string

屬性名稱。

ErrorResponse

錯誤回應。

名稱 類型 Description
error.code

string

服務定義的錯誤碼。 此代碼會作為回應中指定之 HTTP 錯誤碼的子狀態。

error.details

ErrorFieldContract[]

要求中傳送無效欄位的清單,以防發生驗證錯誤。

error.message

string

人類可閱讀的錯誤表示法。

KeyVaultContractCreateProperties

建立keyVault合約詳細數據。

名稱 類型 Description
identityClientId

string

SystemAssignedIdentity 的 Null 或 UserAssignedIdentity 的用戶端識別符,其將用來存取密鑰保存庫密碼。

secretIdentifier

string

用於擷取秘密的金鑰保存庫秘密標識碼。 提供已設定版本的秘密會防止自動重新整理。 這需要 API 管理 服務設定 aka.ms/apimmsi

KeyVaultContractProperties

KeyVault 合約詳細數據。

名稱 類型 Description
identityClientId

string

SystemAssignedIdentity 的 Null 或 UserAssignedIdentity 的用戶端識別符,其將用來存取密鑰保存庫密碼。

lastStatus

KeyVaultLastAccessStatusContractProperties

上次從金鑰保存庫同步處理和重新整理秘密狀態。

secretIdentifier

string

用於擷取秘密的金鑰保存庫秘密標識碼。 提供已設定版本的秘密會防止自動重新整理。 這需要 API 管理 服務設定 aka.ms/apimmsi

KeyVaultLastAccessStatusContractProperties

發出合約更新屬性。

名稱 類型 Description
code

string

上次從金鑰保存庫同步和重新整理秘密的狀態代碼。

message

string

錯誤的詳細數據,否則為空白。

timeStampUtc

string

上次存取秘密的時間。 日期符合下列格式: yyyy-MM-ddTHH:mm:ssZ 如 ISO 8601 標準所指定。

NamedValueContract

NamedValue 詳細數據。

名稱 類型 Description
id

string

資源的完整資源識別碼。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

資源的名稱

properties.displayName

string

NamedValue 的唯一名稱。 只能包含字母、數字、句點、破折號和底線字元。

properties.keyVault

KeyVaultContractProperties

namedValue的KeyVault位置詳細數據。

properties.secret

boolean

決定該值是否為密碼且是否應該加密。 預設值為 False。

properties.tags

string[]

選擇性標記,當提供時可用來篩選 NamedValue 清單。

properties.value

string

NamedValue 的值。 可以包含原則表達式。 不能是空白或只由空白字元組成。 此屬性不會填入 『GET』 作業! 使用 '/listSecrets' POST 要求來取得值。

type

string

資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”

NamedValueCreateContract

NamedValue 詳細數據。

名稱 類型 Description
id

string

資源的完整資源識別碼。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

資源的名稱

properties.displayName

string

NamedValue 的唯一名稱。 只能包含字母、數字、句點、破折號和底線字元。

properties.keyVault

KeyVaultContractCreateProperties

namedValue的KeyVault位置詳細數據。

properties.secret

boolean

決定該值是否為密碼且是否應該加密。 預設值為 False。

properties.tags

string[]

選擇性標記,當提供時可用來篩選 NamedValue 清單。

properties.value

string

NamedValue 的值。 可以包含原則表達式。 不能是空白或只由空白字元組成。 此屬性不會填入 『GET』 作業! 使用 '/listSecrets' POST 要求來取得值。

type

string

資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”