Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Utilizing the New-AzFrontDoorCdnRuleHostNameConditionObject in PowerShell on Windows

In this article, we will explore the usage of the New-AzFrontDoorCdnRuleHostNameConditionObject cmdlet in PowerShell on the Windows platform. This cmdlet is a part of the Azure PowerShell module and allows us to create a hostname condition object for Azure Front Door CDN rules. By understanding how to use this cmdlet, Windows users can effectively manage and configure their Azure Front Door CDN rules.

Azure Front Door is a global service that provides optimized and secure delivery of web applications. It uses the Azure Content Delivery Network (CDN) to cache content at strategically placed locations worldwide, reducing latency and improving performance. CDN rules are used to define the behavior and routing of incoming requests to the Front Door service.

The New-AzFrontDoorCdnRuleHostNameConditionObject cmdlet allows us to create a hostname condition object that can be used in CDN rules. This object specifies the hostnames to be matched for a particular rule. By using this cmdlet, Windows users can easily define custom routing rules based on specific hostnames.

Examples:

Example 1: Creating a hostname condition object for a CDN rule

$condition = New-AzFrontDoorCdnRuleHostNameConditionObject -Operator "Match" -Negate $false -MatchValues "example.com", "www.example.com"

In this example, we create a hostname condition object using the New-AzFrontDoorCdnRuleHostNameConditionObject cmdlet. The -Operator parameter is set to "Match" to specify that the condition should match the provided hostnames. The -Negate parameter is set to $false to indicate that the condition should not be negated. The -MatchValues parameter is used to specify the hostnames to be matched, in this case, "example.com" and "www.example.com".

Example 2: Adding the hostname condition object to a CDN rule

$rule = Get-AzFrontDoorCdnRule -ResourceGroupName "MyResourceGroup" -FrontDoorName "MyFrontDoor" -Name "MyCdnRule"
$rule.Conditions.HostName = $condition
Set-AzFrontDoorCdnRule -ResourceGroupName "MyResourceGroup" -FrontDoorName "MyFrontDoor" -Name "MyCdnRule" -Rule $rule

In this example, we retrieve an existing CDN rule using the Get-AzFrontDoorCdnRule cmdlet. We then assign the previously created hostname condition object to the Conditions.HostName property of the rule. Finally, we update the CDN rule using the Set-AzFrontDoorCdnRule cmdlet.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.