你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Namespace Discovered Devices - Create Or Replace

创建 NamespaceDiscoveredDevice

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/namespaces/{namespaceName}/discoveredDevices/{discoveredDeviceName}?api-version=2026-04-01

URI 参数

名称 必需 类型 说明
discoveredDeviceName
path True

string

minLength: 3
maxLength: 63
pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$

已发现设备的名称。

namespaceName
path True

string

minLength: 3
maxLength: 64
pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$

命名空间的名称。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string (uuid)

目标订阅的 ID。 该值必须是 UUID。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

请求正文

名称 必需 类型 说明
extendedLocation True

ExtendedLocation

扩展位置。

location True

string

资源所在的地理位置

properties.discoveryId True

string

用于检测已发现设备中的更改的标识符。

properties.version True

integer (int64)

每次修改资源时递增的整数。

properties.attributes

一组包含自定义属性的键值对。

properties.endpoints

DiscoveredMessagingEndpoints

已发现设备的终端节点。

properties.externalDeviceId

string

一个设备 ID,表示 Azure 外部系统中的设备。 在 Azure 租户范围内唯一。

properties.manufacturer

string

设备制造商。

properties.model

string

设备模型。

properties.operatingSystem

string

设备作系统名称。

properties.operatingSystemVersion

string

设备作系统版本。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

NamespaceDiscoveredDevice

资源“NamespaceDiscoveredDevice”更新作成功

201 Created

NamespaceDiscoveredDevice

资源“NamespaceDiscoveredDevice”创建作成功

标头

  • Azure-AsyncOperation: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

意外的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流程。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

CreateOrReplace_NamespaceDiscoveredDevice

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/my-namespace-1/discoveredDevices/my-discovereddevice-1?api-version=2026-04-01

{
  "location": "West Europe",
  "extendedLocation": {
    "type": "CustomLocation",
    "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"
  },
  "tags": {
    "site": "building-1"
  },
  "properties": {
    "endpoints": {
      "outbound": {
        "assigned": {
          "eventGridEndpoint": {
            "endpointType": "Microsoft.Devices/IoTHubs",
            "address": "https://myeventgridtopic.westeurope-1.eventgrid.azure.net/api/events"
          }
        }
      }
    },
    "discoveryId": "discoveryId1",
    "version": 1
  }
}

示例响应

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/my-namespace-1/discoveredDevices/my-discovereddevice-1",
  "name": "my-discovereddevice-1",
  "type": "Microsoft.DeviceRegistry/namespaces/discoveredDevices",
  "location": "West Europe",
  "extendedLocation": {
    "type": "CustomLocation",
    "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"
  },
  "tags": {
    "site": "building-1"
  },
  "systemData": {
    "createdBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "createdByType": "Application",
    "createdAt": "2022-11-16T00:36:43.2516899Z",
    "lastModifiedBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "lastModifiedByType": "Application",
    "lastModifiedAt": "2022-11-16T01:37:16.0922793Z"
  },
  "properties": {
    "endpoints": {
      "outbound": {
        "assigned": {
          "eventGridEndpoint": {
            "endpointType": "Microsoft.Devices/IoTHubs",
            "address": "https://myeventgridtopic.westeurope-1.eventgrid.azure.net/api/events"
          }
        }
      }
    },
    "discoveryId": "discoveryId1",
    "version": 1,
    "provisioningState": "Succeeded"
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/my-namespace-1/discoveredDevices/my-discovereddevice-1",
  "name": "my-discovereddevice-1",
  "type": "Microsoft.DeviceRegistry/namespaces/discoveredDevices",
  "location": "West Europe",
  "extendedLocation": {
    "type": "CustomLocation",
    "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"
  },
  "tags": {
    "site": "building-1"
  },
  "systemData": {
    "createdBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "createdByType": "Application",
    "createdAt": "2022-11-16T00:36:43.2516899Z",
    "lastModifiedBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "lastModifiedByType": "Application",
    "lastModifiedAt": "2022-11-16T01:37:16.0922793Z"
  },
  "properties": {
    "endpoints": {
      "outbound": {
        "assigned": {
          "eventGridEndpoint": {
            "endpointType": "Microsoft.Devices/IoTHubs",
            "address": "https://myeventgridtopic.westeurope-1.eventgrid.azure.net/api/events"
          }
        }
      }
    },
    "discoveryId": "discoveryId1",
    "version": 1,
    "provisioningState": "Accepted"
  }
}

定义

名称 说明
AuthenticationMethod

在服务器上对客户端的用户进行身份验证的方法。

createdByType

创建资源的标识的类型。

DeviceMessagingEndpoint

设备消息传递终结点模型。

DiscoveredInboundEndpoints

用于连接到设备的终结点。

DiscoveredMessagingEndpoints

连接终结点 URL:设备可用于连接到服务。

DiscoveredOutboundEndpoints

属性包包含设备的出站终结点

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

ExtendedLocation

扩展位置。

NamespaceDiscoveredDevice

发现的设备定义。

ProvisioningState

资源的预配状态。

systemData

与创建和上次修改资源相关的元数据。

AuthenticationMethod

在服务器上对客户端的用户进行身份验证的方法。

说明
Anonymous

用户身份验证方法是匿名的。

Certificate

用户身份验证方法是 x509 证书。

UsernamePassword

用户身份验证方法是用户名和密码。

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

DeviceMessagingEndpoint

设备消息传递终结点模型。

名称 类型 说明
address

string

要连接到的终端节点地址。

endpointType

string

用于消息收发终端节点的连接类型。

DiscoveredInboundEndpoints

用于连接到设备的终结点。

名称 类型 说明
additionalConfiguration

string

字符串化的 JSON,其中包含连接器要使用的配置(例如 OPC UA、ONVIF)。

address

string

端点地址和端口。 这可以是 IP 地址(例如 192.168.1.1)或完全限定域名(FQDN,例如 server.example.com)。

endpointType

string

连接终端节点的类型。

lastUpdatedOn

string (date-time)

发现终端节点时的时间戳 (UTC)。

supportedAuthenticationMethods

AuthenticationMethod[]

设备支持的入站连接身份验证方法列表。

version

string

与端点关联的协议版本,例如,1 或 2 表示 endpointType Microsoft.HTTP,3.5 或 5.0 表示 endpointType Microsoft.Mqtt 等。

DiscoveredMessagingEndpoints

连接终结点 URL:设备可用于连接到服务。

名称 类型 说明
inbound

<string,  DiscoveredInboundEndpoints>

要连接到设备的终端节点集。

outbound

DiscoveredOutboundEndpoints

设备可以连接到的终端节点集。

DiscoveredOutboundEndpoints

属性包包含设备的出站终结点

名称 类型 说明
assigned

<string,  DeviceMessagingEndpoint>

设备可以连接到的终端节点。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

ExtendedLocation

扩展位置。

名称 类型 说明
name

string

扩展位置名称。

type

string

扩展位置类型。

NamespaceDiscoveredDevice

发现的设备定义。

名称 类型 说明
extendedLocation

ExtendedLocation

扩展位置。

id

string (arm-id)

资源的完全限定资源 ID。 例如,“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”

location

string

资源所在的地理位置

name

string

资源的名称

properties.attributes

一组包含自定义属性的键值对。

properties.discoveryId

string

用于检测已发现设备中的更改的标识符。

properties.endpoints

DiscoveredMessagingEndpoints

已发现设备的终端节点。

properties.externalDeviceId

string

一个设备 ID,表示 Azure 外部系统中的设备。 在 Azure 租户范围内唯一。

properties.manufacturer

string

设备制造商。

properties.model

string

设备模型。

properties.operatingSystem

string

设备作系统名称。

properties.operatingSystemVersion

string

设备作系统版本。

properties.provisioningState

ProvisioningState

资源的预配状态。

properties.version

integer (int64)

每次修改资源时递增的整数。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

tags

object

资源标记。

type

string

资源类型。 例如,“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

ProvisioningState

资源的预配状态。

说明
Succeeded

已创建资源。

Failed

资源创建失败。

Canceled

资源创建已取消。

Accepted

服务器已接受资源。

Deleting

资源正在删除。

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

资源上次修改的时间戳 (UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。