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
public List<ContentValues> parseMovies(JSONArray videoArray) throws JSONException { | |
List<ContentValues> videosToInsert = new ArrayList<>(); | |
String title = video.optString(TAG_TITLE); | |
String description = video.optString(TAG_DESCRIPTION); | |
String short_description = video.optString(TAG_SHORT_DESCRIPTION); | |
if (description.isEmpty()) { | |
description = short_description; | |
} |
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
public List<ContentValues> parseMedia(JSONArray videoArray) throws JSONException { | |
List<ContentValues> videosToInsert = new ArrayList<>(); | |
for (int j = 0; j < videoArray.length(); j++) { | |
JSONObject video = videoArray.getJSONObject(j); | |
String videoUrl = video.optString(TAG_URL); | |
String titleId = video.optString(TAG_TITLE_ID); | |
if (videoUrl.isEmpty()) { | |
if (!titleId.isEmpty()) { |
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
<# | |
.SYNOPSIS | |
Get the ip address from the ip-addresses.json and give these access to all the | |
app services in the given resource group. | |
.DESCRIPTION | |
Get the ip address from the ip-addresses.json and give these access to all the | |
app services in the given resource group. | |
.PARAMETER JsonFilename |
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
function Add-AccessRestrictionToAppService([string] $ResourceGroupName, [string] $Name, [string] $IpFilterRuleName, [string] $IpAddress, [string] $Priority) | |
{ | |
Write-Information "Adding rule $IpFilterRuleName to allow api management service with ip $IpAddress and $Priority access to $Name" | |
Add-AzWebAppAccessRestrictionRule -ResourceGroupName $ResourceGroupName -WebAppName $Name -Name $IpFilterRuleName -Priority $Priority -Action Allow -IpAddress $IpAddress | |
Update-AzWebAppAccessRestrictionConfig -Name $appService.Name -ResourceGroupName $ResourceGroupName -ScmSiteUseMainSiteRestrictionConfig | |
# Also add the access restriction to the staging slots | |
$allSlots = Get-AzWebAppSlot -ResourceGroupName $ResourceGroupName -Name $Name | |
Foreach ($slot in $allSlots) | |
{ |
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
:nextAppService Foreach ($appService in $allAppServices) | |
{ | |
$appServiceName = $appService.Name | |
Foreach ($appServiceToExclude in $AppServicesToExclude) | |
{ | |
if($appServiceToExclude.ToLower().Contains($appServiceName.ToLower())) | |
{ | |
Write-Output "Skipped app service $appServiceName as it is in the exclude list" | |
continue nextAppService |
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
function Add-AccessRestrictionsToAppServices([string] $ResourceGroupName, | |
[string] $JsonFilename, | |
[bool] $RemoveExistingRules, | |
[string[]] $AppServicesToExclude) | |
{ | |
Write-Information "Retrieving all app services in $ResourceGroupName" | |
$allAppServices = Get-AzWebApp -ResourceGroupName $ResourceGroupName | |
$confirmAppServicesToExclude = Confirm-AppServicesToExclude -AllAppServices $allAppServices -AppServicesToExclude $AppServicesToExclude | |
if (!$confirmAppServicesToExclude) |
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
[ | |
{ "rulename": "gateway", "ipaddress": "213.46.145.111", "priority": "200" }, | |
{ "rulename": "vpn", "ipaddress": "210.46.145.111", "priority": "300" }, | |
{ "rulename": "test", "ipaddress": "215.46.145.111", "priority": "400" } | |
] |
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
<# | |
.SYNOPSIS | |
Remove all access restrictions from the app services in the given resource group | |
.DESCRIPTION | |
The Remove-AccessRestrictions.ps1 script removes all access restrictions from | |
the app services in the given resource group | |
.PARAMETER resourceGroupName | |
The resource group with the app services to remove the access restrictions |
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
function Remove-AccessRestrictionsFromAppService([string] $ResourceGroupName, [string] $Name) { | |
$config = Get-AzWebAppAccessRestrictionConfig -ResourceGroupName $ResourceGroupName -Name $Name | |
Write-Information "Removing existing access restrictions on $Name" | |
Foreach ($accessRestriction in $config.MainSiteAccessRestrictions) { | |
$ruleName = $accessRestriction.RuleName | |
Write-Debug "Removing rule $ruleName" | |
Remove-AzWebAppAccessRestrictionRule -ResourceGroupName $ResourceGroupName -WebAppName $Name -Name $accessRestriction.RuleName | |
} | |
# Also remove all the access restriction from the staging slots |
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
function Remove-AllAccessRestrictionsFromAppServices([string] $ResourceGroupName) { | |
Write-Information "Retrieving all app services in $ResourceGroupName" | |
$allAppServices = Get-AzWebApp -ResourceGroupName $ResourceGroupName | |
Foreach ($appService in $allAppServices) { | |
Remove-AccessRestrictionsFromAppService -ResourceGroupName $ResourceGroupName -Name $appService.Name | |
} | |
} |