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-AzCdnDeliveryRuleQueryStringConditionObject in PowerShell for Windows

In this article, we will explore the usage of the New-AzCdnDeliveryRuleQueryStringConditionObject in PowerShell specifically for the Windows environment. The New-AzCdnDeliveryRuleQueryStringConditionObject is a powerful feature in Azure Content Delivery Network (CDN) that allows you to define rules based on query string conditions. This feature is essential for optimizing the delivery of content and improving user experience.

With the New-AzCdnDeliveryRuleQueryStringConditionObject, you can specify conditions based on query string parameters and their values. This allows you to control how content is cached and delivered to users based on specific query string values. By leveraging this feature, you can ensure that the right content is delivered to the right users at the right time.

Examples:

Example 1: Creating a CDN delivery rule using New-AzCdnDeliveryRuleQueryStringConditionObject

$cdnProfile = Get-AzCdnProfile -ResourceGroupName "YourResourceGroup" -ProfileName "YourCDNProfile"
$cdnEndpoint = Get-AzCdnEndpoint -ProfileName $cdnProfile.ProfileName -EndpointName "YourEndpoint"

$conditionObject = New-AzCdnDeliveryRuleQueryStringConditionObject -Operator "Equal" -QueryStringKey "param1" -QueryStringValue "value1"

$deliveryRule = New-AzCdnDeliveryRule -ProfileName $cdnProfile.ProfileName -EndpointName $cdnEndpoint.EndpointName -Order 1 -ActionName "CacheExpiration" -CacheBehavior "BypassCache" -QueryStringCondition $conditionObject

$cdnEndpoint | Set-AzCdnEndpoint

Example 2: Updating an existing CDN delivery rule with New-AzCdnDeliveryRuleQueryStringConditionObject

$cdnProfile = Get-AzCdnProfile -ResourceGroupName "YourResourceGroup" -ProfileName "YourCDNProfile"
$cdnEndpoint = Get-AzCdnEndpoint -ProfileName $cdnProfile.ProfileName -EndpointName "YourEndpoint"

$conditionObject = New-AzCdnDeliveryRuleQueryStringConditionObject -Operator "Contains" -QueryStringKey "param2" -QueryStringValue "value2"

$deliveryRule = Get-AzCdnDeliveryRule -ProfileName $cdnProfile.ProfileName -EndpointName $cdnEndpoint.EndpointName -RuleName "YourDeliveryRule"
$deliveryRule.QueryStringCondition = $conditionObject

$deliveryRule | Set-AzCdnDeliveryRule

$cdnEndpoint | Set-AzCdnEndpoint

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.