New-AzDeviceRegistryNamespace
Syntax
CreateExpanded (Default)
New-AzDeviceRegistryNamespace
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-SubscriptionId <String>]
[-EnableSystemAssignedIdentity]
[-MessagingEndpoint <Hashtable>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonFilePath
New-AzDeviceRegistryNamespace
-Name <String>
-ResourceGroupName <String>
-JsonFilePath <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonString
New-AzDeviceRegistryNamespace
-Name <String>
-ResourceGroupName <String>
-JsonString <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Examples
Example 1: Create Namespace with Expanded Parameters
$endpointsHashtable = @{
"my-endpoint1" = @{
"resourceId" = "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.IotHub/namespaces/my-hub-namespace1"
"address" = "https://my-endpoint1.westeurope-1.iothub.azure.net"
"endpointType" = "Microsoft.Devices/IotHubs"
}
"my-endpoint2" = @{
"resourceId" = "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.IotHub/namespaces/my-hub-namespace2"
"address" = "https://my-endpoint2.westeurope-1.iothub.azure.net"
"endpointType" = "Microsoft.Devices/IotHubs"
}
}
New-AzDeviceRegistryNamespace -Name "my-namespace" -ResourceGroupName "my-resource-group" -Location "eastus" -MessagingEndpoint $endpointsHashtable
Id : /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microso
ft.DeviceRegistry/namespaces/my-namespace
IdentityPrincipalId :
IdentityTenantId :
IdentityType : None
Location : eastus2
MessagingEndpoint : {
"myendpoint1": {
"endpointType": "Microsoft.Devices/IotHubs",
"address": "https://myendpoint1.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.EventGrid/namespaces/contoso-hub-namespace1"
},
"myendpoint2": {
"endpointType": "Microsoft.Devices/IoTHubs",
"address": "https://myendpoint2.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.IotHub/namespaces/contoso-edge-namespace2"
}
}
Name : my-namespace
ProvisioningState : Succeeded
ResourceGroupName : my-resource-group
SystemDataCreatedAt : 7/22/2025 5:15:28 AM
SystemDataCreatedBy : 739f5293-922a-4616-b106-3662530ef99f
SystemDataCreatedByType : Application
SystemDataLastModifiedAt : 7/23/2025 6:44:04 PM
SystemDataLastModifiedBy : user@outlook.com
SystemDataLastModifiedByType : User
Tag : {
}
Type : microsoft.deviceregistry/namespaces
Uuid : 04aea28f-0906-4c2c-a716-23971af76d82
Creates a new Namespace using expanded parameters.
Example 2: Create Namespace via JSON File Path
New-AzDeviceRegistryNamespace -Name "my-namespace" -ResourceGroupName "my-resource-group" -JsonFilePath "C:\path\to\namespace.json"
Id : /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microso
ft.DeviceRegistry/namespaces/my-namespace
IdentityPrincipalId :
IdentityTenantId :
IdentityType : None
Location : eastus2
MessagingEndpoint : {
"myendpoint1": {
"endpointType": "Microsoft.Devices/IotHubs",
"address": "https://myendpoint1.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.EventGrid/namespaces/contoso-hub-namespace1"
},
"myendpoint2": {
"endpointType": "Microsoft.Devices/IoTHubs",
"address": "https://myendpoint2.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.IotHub/namespaces/contoso-edge-namespace2"
}
}
Name : my-namespace
ProvisioningState : Succeeded
ResourceGroupName : my-resource-group
SystemDataCreatedAt : 7/22/2025 5:15:28 AM
SystemDataCreatedBy : 739f5293-922a-4616-b106-3662530ef99f
SystemDataCreatedByType : Application
SystemDataLastModifiedAt : 7/23/2025 6:44:04 PM
SystemDataLastModifiedBy : user@outlook.com
SystemDataLastModifiedByType : User
Tag : {
}
Type : microsoft.deviceregistry/namespaces
Uuid : 04aea28f-0906-4c2c-a716-23971af76d82
Creates a new namespace using a JSON file that contains the namespace properties.
Example 3: Create Namespace via JSON String
$jsonString = Get-Content -Path "C:\path\to\namespace.json" -Raw
New-AzDeviceRegistryNamespace -Name "my-namespace" -ResourceGroupName "my-resource-group" -JsonString $jsonString
Id : /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microso
ft.DeviceRegistry/namespaces/my-namespace
IdentityPrincipalId :
IdentityTenantId :
IdentityType : None
Location : eastus2
MessagingEndpoint : {
"myendpoint1": {
"endpointType": "Microsoft.Devices/IotHubs",
"address": "https://myendpoint1.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.EventGrid/namespaces/contoso-hub-namespace1"
},
"myendpoint2": {
"endpointType": "Microsoft.Devices/IoTHubs",
"address": "https://myendpoint2.westeurope-1.iothub.azure.net",
"resourceId": "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.IotHub/namespaces/contoso-edge-namespace2"
}
}
Name : my-namespace
ProvisioningState : Succeeded
ResourceGroupName : my-resource-group
SystemDataCreatedAt : 7/22/2025 5:15:28 AM
SystemDataCreatedBy : 739f5293-922a-4616-b106-3662530ef99f
SystemDataCreatedByType : Application
SystemDataLastModifiedAt : 7/23/2025 6:44:04 PM
SystemDataLastModifiedBy : user@outlook.com
SystemDataLastModifiedByType : User
Tag : {
}
Type : microsoft.deviceregistry/namespaces
Uuid : 04aea28f-0906-4c2c-a716-23971af76d82
Creates a new Namespace using a JSON string that contains the namespace properties.
Parameters
-AsJob
Run the command as a job
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The DefaultProfile parameter is not functional.
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Parameter properties
Type: PSObject
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzureRMContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EnableSystemAssignedIdentity
Determines whether to enable a system-assigned identity for the resource.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateExpanded
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-JsonFilePath
Path of Json file supplied to the Create operation
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateViaJsonFilePath
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-JsonString
Json string supplied to the Create operation
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateViaJsonString
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Location
The geo-location where the resource lives
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateExpanded
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-MessagingEndpoint
Dictionary of messaging endpoints.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateExpanded
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
The name of the namespace.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: NamespaceName
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-NoWait
Run the command asynchronously
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
The name of the resource group.
The name is case insensitive.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SubscriptionId
The ID of the target subscription.
The value must be an UUID.
Parameter properties
Type: String
Default value: (Get-AzContext).Subscription.Id
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Tag
Resource tags.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
CreateExpanded
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs