Set-AzureServiceAntimalwareExtension

Configures the Microsoft Antimalware extension for cloud services.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Service Management APIs. See the Az PowerShell module for cmdlets to manage Azure Resource Manager resources.

Important

Cloud Services (classic) is now deprecated for new customers and will be retired on August 31st, 2024 for all customers. New deployments should use the new Azure Resource Manager based deployment model Azure Cloud Services (extended support).

Syntax

Set-AzureServiceAntimalwareExtension
   [-ServiceName] <String>
   [[-Slot] <String>]
   [[-Role] <String[]>]
   [[-AntimalwareConfiguration] <XmlDocument>]
   [[-Monitoring] <String>]
   [[-StorageContext] <AzureStorageContext>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureServiceAntimalwareExtension
   [-ServiceName] <String>
   [[-Slot] <String>]
   [[-Role] <String[]>]
   [[-AntimalwareConfiguration] <XmlDocument>]
   [[-Monitoring] <String>]
   [[-StorageContext] <AzureStorageContext>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Set-AzureServiceAntimalwareExtension cmdlet configures the Microsoft Antimalware extension for a cloud service. You can specify values that override and supplement values in the XML configuration, such as the storage account context.

Examples

Example 1: Enable the extension

PS C:\> [System.Xml.XmlDocument] $XmlConfig = New-Object System.Xml.XmlDocument 
PS C:\> $XmlConfig.load('C:\configuration\contosoVM.xml')
PS C:\> Set-AzureServiceAntimalwareExtension -ServiceName "ContosoService03" -AntimalwareConfiguration $XmlConfig
Operation succeeded

The first two commands create an XmlDocument object that contains a configuration for the Microsoft Antimalware extension, and then stores it in the $XmlConfig variable.

Example 2: Enable the extension for the Staging slot

PS C:\> [System.Xml.XmlDocument] $XmlConfig = New-Object System.Xml.XmlDocument 
PS C:\> $XmlConfig.load('C:\configuration\contosoVM.xml')
PS C:\> Set-AzureServiceAntimalwareExtension -ServiceName "ContosoService03" -Slot "Staging" -AntimalwareConfiguration $XmlConfig 
Operation succeeded

The first two commands create an XmlDocument object that contains a configuration for the Microsoft Antimalware extension, and then stores it in the $XmlConfig variable.

Example 3: Enable the extension with monitoring

PS C:\> System.Xml.XmlDocument] $XmlConfig = New-Object System.Xml.XmlDocument 
PS C:\> $XmlConfig.load('C:\configuration\contosoVM.xml')
PS C:\> $StorageContext = New-AzureStorageContext -StorageAccountName "contosostoragemain" -StorageAccountKey (Get-AzureStorageKey -StorageAccountName "Contosostoragemain").Primary
PS C:\> Set-AzureServiceAntimalwareExtension -ServiceName "ContosoService03" -AntimalwareConfiguration $XmlConfig -Monitoring ON -StorageContext $StorageContext

The first two commands create an XmlDocument object that contains a configuration for the Microsoft Antimalware extension, and then stores it in the $XmlConfig variable.

Parameters

-AntimalwareConfiguration

Specifies an XmlDocument object that contains the Microsoft Antimalware configuration. This object must not be $Null or empty. The configuration object must include, at a minimum, the following content to enable the Microsoft Antimalware extension:

\<AntimalwareConfig\>\<AntimalwareEnabled\>true\</AntimalwareEnabled\>\</AntimalwareConfig\>

Type:XmlDocument
Position:3
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Monitoring

Specifies whether to collect Microsoft Antimalware events. Valid values are:

  • ON. Collect Microsoft Antimalware events to storage context.

  • OFF. Do not collect Microsoft Antimalware events.

Type:String
Position:4
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Role

Specifies an array of roles. The default value is all roles.

Type:String[]
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ServiceName

Specifies the name of the cloud service.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Slot

Specifies a deployment slot. Valid values are:

  • Production

  • Staging

The default value is Production.

Type:String
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-StorageContext

Specifies an Azure storage context for Microsoft Antimalware monitoring.

Type:AzureStorageContext
Position:5
Default value:None
Accept pipeline input:True
Accept wildcard characters:False