你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzureDeployment
修改部署的状态、配置设置或升级模式。
注意
本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧式 Azure 资源。 创建新资源时,建议不要使用旧的 PowerShell 模块,因为计划将停用 ASM。 有关详细信息,请参阅 Azure Service Manager 停用。
Az PowerShell 模块是建议用于管理 PowerShell 的 Azure 资源管理器 (ARM) 资源的 PowerShell 模块。
重要
新客户的云服务(经典版)现已弃用,并将于 2024 年 8 月 31 日对所有客户停用。 新部署应使用基于 Azure 资源管理器 的新部署模型 Azure 云服务(扩展支持)。
语法
Set-AzureDeployment
[-Upgrade]
[-ServiceName] <String>
[-Package] <String>
[-Configuration] <String>
[-Slot] <String>
[[-Mode] <String>]
[[-Label] <String>]
[[-RoleName] <String>]
[-Force]
[[-ExtensionConfiguration] <ExtensionConfigurationInput[]>]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureDeployment
[-Config]
[-ServiceName] <String>
[-Configuration] <String>
[-Slot] <String>
[[-ExtensionConfiguration] <ExtensionConfigurationInput[]>]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureDeployment
[-Status]
[-ServiceName] <String>
[-Slot] <String>
[-NewStatus] <String>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
说明
Set-AzureDeployment cmdlet 修改 Azure 部署的状态、配置设置或升级模式。 可以将部署的状态更改为“正在运行”或“已挂起”。 可以更改部署的 .cscfg 文件。 可以设置升级模式和更新配置文件。 使用 Set-AzureWalkUpgradeDomain cmdlet 启动升级。
示例
示例 1:更改部署的状态
PS C:\> Set-AzureDeployment -Status -ServiceName "ContosoService" -Slot "Production" -NewStatus "Running"
此命令将生产环境中名为 ContosoService 的服务的部署状态设置为“正在运行”。
示例 2:将不同的配置文件分配给部署
PS C:\> Set-AzureDeployment -Config -ServiceName "ContosoService" -Slot "Staging" -Configuration "C:\Temp\MyServiceConfig.Cloud.csfg"
此命令为暂存环境中名为 ContosoService 的服务的部署分配不同的配置文件。
示例 3:将升级模式设置为“自动”
PS C:\> Set-AzureDeployment -Upgrade -ServiceName "ContosoService" -Mode Auto -Package "C:\packages\ContosoApp.cspkg" -Configuration "C:\Config\ContosoServiceConfig.Cloud.csfg"
此命令将升级模式设置为“自动”,并指定升级包和新配置文件。
示例 4:在服务中安装扩展配置
PS C:\> Set-AzureDeployment -Config -ServiceName "ContosoService" -Mode "Automatic" -Package "https://contosostorage.blob.core.windows.net/container06/ContosoPackage.cspkg" -Configuration "C:\packages\ContosoConfiguration.cscfg" -Slot "Production" -ExtensionConfiguration "C:\packages\ContosoExtensionConfig.cscfg"
此命令在指定的云服务中安装扩展配置,并将其应用于角色。
参数
-Config
指定此 cmdlet 修改部署的配置。
类型: | SwitchParameter |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Configuration
指定 .cscfg 配置文件的完整路径。 可以指定升级或更改配置的配置文件。
类型: | String |
Position: | 3 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ExtensionConfiguration
指定扩展配置对象的数组。
类型: | ExtensionConfigurationInput[] |
Position: | 9 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Force
指示 cmdlet 执行强制升级。
类型: | SwitchParameter |
Position: | 8 |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InformationAction
指定此 cmdlet 如何响应信息事件。
此参数的可接受值为:
- 继续
- 忽略
- 询问
- SilentlyContinue
- 停止
- Suspend
类型: | ActionPreference |
别名: | infa |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InformationVariable
指定信息变量。
类型: | String |
别名: | iv |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Label
指定升级部署的标签。
类型: | String |
Position: | 6 |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Mode
指定升级模式。 有效值为:
- 自动
- 手动
- 同时
类型: | String |
Position: | 5 |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-NewStatus
指定部署的目标状态。 有效值为:正在运行和挂起。
类型: | String |
Position: | 3 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Package
指定升级包文件的完整路径。
类型: | String |
Position: | 2 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Profile
指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。
类型: | AzureSMProfile |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RoleName
指定要升级的角色的名称。
类型: | String |
Position: | 7 |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ServiceName
指定部署的 Azure 服务的名称。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Slot
指定要修改的部署环境。 有效值为:生产和过渡。
类型: | String |
Position: | 4 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Status
指定此 cmdlet 更改部署的状态。
类型: | SwitchParameter |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Upgrade
指定此 cmdlet 升级部署。
类型: | SwitchParameter |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |