Edit

Share via


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 Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

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

SetExtension (Default)

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

SetExtensionUsingThumbprint

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\>

Parameter properties

Type:XmlDocument
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Parameter properties

Type:ActionPreference
Default value:None
Supports wildcards:False
DontShow:False
Aliases:infa

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationVariable

Specifies an information variable.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:iv

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
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

-Role

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServiceName

Specifies the name of the cloud service.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Slot

Specifies a deployment slot. Valid values are:

  • Production

  • Staging

The default value is Production.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageContext

Specifies an Azure storage context for Microsoft Antimalware monitoring.

Parameter properties

Type:AzureStorageContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
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.