This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $azContext = Get-AzureRmContext | |
| $azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile | |
| $profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile) | |
| $token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId) | |
| $authHeader = @{ | |
| 'Content-Type'='application/json' | |
| 'Authorization'='Bearer ' + $token.AccessToken | |
| } | |
| # Invoke the REST API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get Web App Data | |
| $AppService = Get-AzureRmWebApp -Name "WebAppName" -ResourceGroupName "ResourceGroupName" | |
| # Get Resource | |
| $AppResource = Get-AzureRmResource -ResourceId $AppService.Id | |
| # Force use of HTTPS only | |
| $Properties = @{httpsOnly = $true} | |
| # Commit changes | |
| Set-AzureRmResource -ResourceName $AppResource.Name -ResourceGroupName $AppResource.ResourceGroupName -Properties $Properties -ResourceType "Microsoft.Web/sites" -Force |