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

Set-AzureWebsite

配置在 Azure 中运行的网站。

注意

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

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

语法

Set-AzureWebsite
   [-NumberOfWorkers <Int32>]
   [-DefaultDocuments <String[]>]
   [-NetFrameworkVersion <String>]
   [-PhpVersion <String>]
   [-RequestTracingEnabled <Boolean>]
   [-HttpLoggingEnabled <Boolean>]
   [-DetailedErrorLoggingEnabled <Boolean>]
   [-HostNames <String[]>]
   [-AppSettings <Hashtable>]
   [-Metadata <System.Collections.Generic.List`1[Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.NameValuePair]>]
   [-ConnectionStrings <ConnStringPropertyBag>]
   [-HandlerMappings <HandlerMapping[]>]
   [-SiteWithConfig <SiteWithConfig>]
   [-PassThru]
   [-ManagedPipelineMode <ManagedPipelineMode>]
   [-WebSocketsEnabled <Boolean>]
   [-RoutingRules <System.Collections.Generic.List`1[Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.RoutingRule]>]
   [-Use32BitWorkerProcess <Boolean>]
   [-AutoSwapSlotName <String>]
   [-SlotStickyAppSettingNames <System.Collections.Generic.List`1[System.String]>]
   [-SlotStickyConnectionStringNames <System.Collections.Generic.List`1[System.String]>]
   [-Name <String>]
   [-Slot <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

说明

本主题介绍 Microsoft Azure PowerShell 模块的 0.8.10 版本中的 cmdlet。 若要获取正在使用的模块版本,请在 Azure PowerShell 控制台中键入 (Get-Module -Name Azure).Version

Set-AzureWebsite cmdlet 配置在 Azure 中运行的网站。

示例

示例 1:为网站启用 HTTP 日志记录

PS C:\> Set-AzureWebsite -HttpLoggingEnabled 1

此示例启用 HTTP 日志记录。

示例 2:设置网站的存储凭据

PS C:\> $settings = New-Object Hashtable$settings["AZURE_STORAGE_ACCOUNT"= myaccountname$settings["AZURE_STORAGE_ACCESS_KEY"] = myaccesskeySet-AzureWebsite -AppSettings $settings myWebsite

此示例使用AZURE_STORAGE_ACCOUNT和AZURE_STORAGE_ACCESS_KEY环境变量在名为 myWebsite 的网站中设置存储凭据。

参数

-AppSettings

指定网站将使用的环境变量。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-AutoSwapSlotName

类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-ConnectionStrings

指定网站使用的连接字符串。

类型:ConnStringPropertyBag
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultDocuments

指定浏览网站时自动显示的文档。

类型:String[]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-DetailedErrorLoggingEnabled

确定是否为网站记录详细的 IIS 错误。

类型:Boolean
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-HandlerMappings

指定网站使用的处理程序映射。

类型:HandlerMapping[]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-HostNames

指定可用于访问网站的完全限定主机名。

类型:String[]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-HttpLoggingEnabled

确定是否为网站启用了 http 日志记录。

类型:Boolean
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-ManagedPipelineMode

指定托管管道模式。

类型:ManagedPipelineMode
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-Metadata

指定网站的元数据。

类型:List<T>[Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.NameValuePair]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

指定网站的名称。

类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-NetFrameworkVersion

指定网站所需的 .Net Framework 版本。

类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-NumberOfWorkers

指定运行网站的辅助进程数。

类型:Int32
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

指示此 cmdlet 返回 布尔 值。

类型:SwitchParameter
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-PhpVersion

指定网站所需的 PHP 版本。

类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-Profile

指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。

类型:AzureSMProfile
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-RequestTracingEnabled

确定是否为网站启用了请求跟踪。

类型:Boolean
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-RoutingRules

指定要在生产环境中进行测试的路由规则。

类型:List<T>[Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.RoutingRule]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-SiteWithConfig

指定网站使用的配置。

类型:SiteWithConfig
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-Slot

指定网站的槽名称。

类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-SlotStickyAppSettingNames

类型:List<T>[String]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-SlotStickyConnectionStringNames

类型:List<T>[String]
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-Use32BitWorkerProcess

指定是否启用 32 位模式。

类型:Boolean
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False

-WebSocketsEnabled

指定是否启用 WebSocket。

类型:Boolean
Position:Named
默认值:None
必需:False
Accept pipeline input:True
Accept wildcard characters:False