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

Set-AzureStorSimpleDevice

更改设备的设备配置。

注意

本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧 Azure 资源。 创建新的资源时,不建议使用此旧版 PowerShell 模块,因为 ASM 计划停用。 有关详细信息,请参阅 Azure Service Manager 停用

Az PowerShell 模块是推荐的 PowerShell 模块,用于使用 PowerShell 管理 Azure 资源管理器 (ARM) 资源。

语法

Set-AzureStorSimpleDevice
   -DeviceName <String>
   [-NewName <String>]
   [-TimeZone <TimeZoneInfo>]
   [-SecondaryDnsServer <String>]
   [-StorSimpleNetworkConfig <NetworkConfig[]>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Set-AzureStorSimpleDevice
   -DeviceId <String>
   [-NewName <String>]
   [-TimeZone <TimeZoneInfo>]
   [-SecondaryDnsServer <String>]
   [-StorSimpleNetworkConfig <NetworkConfig[]>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

说明

Set-AzureStorSimpleDevice cmdlet 更改设备的设备配置。 如果要首次设置设备,则必须指定 TimeZoneSecondaryDnsServerStorSimpleNetworkConfig 参数。 必须使用 controller0 和 controller1 和 IP 地址包含 Data0 的网络配置。 必须至少有一个已启用 Internet SCSI(ISCSI)的网络接口才能首次配置设备。

示例

示例 1:修改设备的配置

PS C:\>$NetworkConfigData0 = New-AzureStorSimpleNetworkConfig -InterfaceAlias Data0 -EnableIscsi $True -Controller0IPv4Address "10.67.64.48" -Controller1IPv4Address "10.67.64.49" 
PS C:\> $TimeZoneInfo = [System.TimeZoneInfo]::GetSystemTimeZones() | where { $_.Id -eq "Pacific Standard Time" }
PS C:\> $OnlineDevice = @(Get-AzureStorSimpleDevice | Where { $_.Status -eq "Online"})[0]
PS C:\> $UpdatedDetails = Set-AzureStorSimpleDevice -DeviceId $OnlineDevice.DeviceId -NewName "Device22" -TimeZone $TimeZoneInfo -SecondaryDnsServer 10.8.8.8 -StorSimpleNetworkConfig $NetworkConfigData0
VERBOSE: ClientRequestId: 0f163163-5ad0-4635-a7b5-870d47297f66_PS
VERBOSE: Successfully created a StorSimple Network Configuration for interface Data0
VERBOSE: ClientRequestId: 552e4a6c-7006-4015-a20b-9def6428a85e_PS
VERBOSE: ClientRequestId: f31cc84c-bc8a-404a-9da6-4670a7999e75_PS
VERBOSE: 1 StorSimple device found! 
VERBOSE: ClientRequestId: 545bc1a9-3c1b-4e50-89a6-9678aefe79e5_PS
VERBOSE: ClientRequestId: f114ad08-47f5-4fb8-8a01-1ea7f1ed1b98_PS
VERBOSE: About to configure the device : Device22 ! 
VERBOSE: ClientRequestId: 6afe7927-1c19-48d3-ac22-68148fd056b8_PS
VERBOSE: The task created for your Setup operation has completed successfully. 
VERBOSE: ClientRequestId: 467c142c-90da-4d75-82a4-c114afce953d_PS
VERBOSE: Successfully updated configuration for device Device22 with id 865e68f6-1e71-47b6-80d5-15d3a23bd2b0

第一个命令为 Data0 接口创建网络配置。 此命令指定 Controller0IPv4AddressController1IPv4AddressEnableIscsi 参数。 该命令将结果存储在 $NetworkConfigData 0 变量中。

第二个命令使用 System.TimeZoneInfo .NET 类和标准语法获取太平洋标准时区,并将该对象存储在$TimeZoneInfo变量中。

第三个命令使用 Get-AzureStorSimpleDevice cmdlet 和 Where-Object 核心 cmdlet 获取联机 StorSimple 设备,然后将其存储在$OnlineDevice变量中。

最后一个命令修改具有指定设备 ID 的设备的配置。 该命令使用在第一个命令中创建的当前 cmdlet 的配置对象。 该命令使用存储在$TimeZoneInfo中的时区。

示例 2:管道配置对象以修改设备

PS C:\>$TimeZoneInfo = [System.TimeZoneInfo]::GetSystemTimeZones() | where { $_.Id -eq "Pacific Standard Time" }
PS C:\> $OnlineDevice = @(Get-AzureStorSimpleDevice | Where { $_.Status -eq "Online"})[0]
PS C:\> $UpdatedDetails = New-AzureStorSimpleNetworkConfig -InterfaceAlias Data0 -EnableIscsi $True -Controller0IPv4Address "10.67.64.48" -Controller1IPv4Address "10.67.64.49" | Set-AzureStorSimpleDevice -DeviceId $OnlineDevice.DeviceId -NewName "Device22" -TimeZone $TimeZoneInfo -SecondaryDnsServer 10.8.8.8 
VERBOSE: ClientRequestId: fa2f5000-169c-4feb-abbf-23f4b5c837fa_PS
VERBOSE: Successfully created a StorSimple Network Configuration for interface Data0
VERBOSE: ClientRequestId: fae6a491-919c-44b2-93e0-0c51f202c24b_PS
VERBOSE: ClientRequestId: e1803427-a097-4d58-ab7d-14a4c39fd768_PS
VERBOSE: 1 StorSimple device found! 
VERBOSE: ClientRequestId: 9e796c3d-3100-46ab-9a09-0e10c73a296f_PS
VERBOSE: ClientRequestId: 5b4cad96-31f4-4d07-a278-df5af3e06ad4_PS
VERBOSE: About to configure the device : Device22 ! 
VERBOSE: ClientRequestId: 9061f7df-144f-4f30-858c-045d882ca392_PS
VERBOSE: The task created for your Setup operation has completed successfully. 
VERBOSE: ClientRequestId: 2ed2fa9b-8459-4cd6-9a61-5fc25ced2815_PS
VERBOSE: Successfully updated configuration for device Device22 with id 865e68f6-1e71-47b6-80d5-15d3a23bd2b0

此示例执行与第一个示例相同的配置更新,但最终命令使用管道运算符将网络配置对象传递到当前 cmdlet。

示例 3:通过管道通过时区对象修改设备

PS C:\>$NetworkConfigData0 = New-AzureStorSimpleNetworkConfig -InterfaceAlias Data0 -EnableIscsi $True -Controller0IPv4Address "10.67.64.48" -Controller1IPv4Address "10.67.64.49" 
PS C:\> $OnlineDevice = @(Get-AzureStorSimpleDevice | Where { $_.Status -eq "Online"})[0]
PS C:\> $UpdatedDetails = [System.TimeZoneInfo]::GetSystemTimeZones() | where { $_.Id -eq "Pacific Standard Time" } | Set-AzureStorSimpleDevice -DeviceId $OnlineDevice.DeviceId -NewName "Device22" -SecondaryDnsServer 10.8.8.8 -StorSimpleNetworkConfig $NetworkConfigData0
VERBOSE: ClientRequestId: cfc3f3c7-a8b6-462b-96f4-124050b736fe_PS
VERBOSE: Successfully created a StorSimple Network Configuration for interface Data0
VERBOSE: ClientRequestId: 6017b76f-a771-4bf8-901e-14876e0f9962_PS
VERBOSE: ClientRequestId: 59a9275c-9005-4e8a-b68b-efa1e6c27d47_PS
VERBOSE: 1 StorSimple device found! 
VERBOSE: ClientRequestId: 08e5142a-b038-4607-8690-0c5a8b948352_PS
VERBOSE: ClientRequestId: 218af244-b8f4-4a4b-817e-8f67e1323f03_PS
VERBOSE: About to configure the device : Device22 ! 
VERBOSE: ClientRequestId: fbd1f32d-1d74-432e-9dc0-90b46674884a_PS
VERBOSE: The task created for your Setup operation has completed successfully. 
VERBOSE: ClientRequestId: 981cb941-252c-4898-ba9f-f19e5b8bcaa4_PS
VERBOSE: Successfully updated configuration for device Device22 with id 865e68f6-1e71-47b6-80d5-15d3a23bd2b0

此示例执行与第一个示例相同的配置更新,但最后一个命令使用管道运算符将时区对象传递到当前 cmdlet。

参数

-DeviceId

指定要配置的 StorSimple 设备的实例 ID。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-DeviceName

指定要配置的 StorSimple 设备的友好名称。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-NewName

指定 StorSimple 设备的新友好名称。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Profile

指定 Azure 配置文件。

类型:AzureSMProfile
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-SecondaryDnsServer

指定 StorSimple 设备的辅助 DNS 服务器。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-StorSimpleNetworkConfig

为设备上的接口指定网络配置对象的数组。 若要获取 NetworkConfig 对象,请使用 New-AzureStorSimpleNetworkConfig cmdlet。

类型:NetworkConfig[]
Position:Named
默认值:None
必需:False
接受管道输入:True
接受通配符:False

-TimeZone

指定设备的时区。 可以使用 GetSystemTimeZone() 方法创建 TimeZoneInfo 对象。 例如,此命令为太平洋标准时间创建时区信息对象: \[System.TimeZoneInfo\]::GetSystemTimeZones() | where { $_.Id -eq "Pacific Standard Time" }

类型:TimeZoneInfo
Position:Named
默认值:None
必需:False
接受管道输入:True
接受通配符:False

输入

NetworkConfig, TimeZoneInfo

可以通过管道将 NetworkConfig 对象或 TimeZoneInfo 传递给此 cmdlet。

输出

DeviceDetails

此 cmdlet 返回虚拟设备的更新设备详细信息。