Skip to content

Instantly share code, notes, and snippets.

@pratapprashant
Last active June 19, 2016 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratapprashant/5c65fccda3e7a40f1234a4fafcaf5c8d to your computer and use it in GitHub Desktop.
Save pratapprashant/5c65fccda3e7a40f1234a4fafcaf5c8d to your computer and use it in GitHub Desktop.
$resourceGroupName = "pscmdletResourceGroup"
$appServicePlanName = "pscmdletServicePlan"
$newWebsiteName = "pscmdletWebsite"
$location = "West US"
$error.clear()
write-host "trying to load azure dlls"
Import-module azure
write-host "trying to set the default subsription"
#Select-AzureSubscription -Default "Microsoft Azure Internal Consumption"
#Add-AzureAccount
#Login-AzureRmAccount
write-host "trying to create resource group"
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
if ($Error.Count -eq 0 )
{
write-host "created resource group"
}
else
{
exit
}
write-host "trying to create App Service Plan"
New-AzureRmAppServicePlan -ResourceGroupName $resourceGroupName -Name $appServicePlanName -Location $location -Tier "Basic"
if ($Error.Count -eq 0 )
{
write-host "created app service plan"
}
else
{
exit
}
write-host "trying to create website"
New-AzureRmWebApp -ResourceGroupName $resourceGroupName -Name $newWebsiteName -Location $location -AppServicePlan $appServicePlanName
if ($Error.Count -eq 0 )
{
write-host "created website"
}
else
{
exit
}
#Start-AzureRmWebApp -Name "MyWebApp" -ResourceGroupName "Default-Web-WestUS"
#Stop-AzureRmWebApp -Name "MyWebApp" -ResourceGroupName "Default-Web-WestUS"
#Set-AzureRMWebApp [-ResourceGroupName] <String> [-Name] <String> [[-AppServicePlan] <String> ] [[-DefaultDocuments] <String[]> ] [[-NetFrameworkVersion] <String> ] [[-PhpVersion] <String> ] [[-RequestTracingEnabled] <Boolean> ] [[-HttpLoggingEnabled] <Boolean> ] [[-DetailedErrorLoggingEnabled] <Boolean> ] [[-AppSettings] <Hashtable> ] [[-ConnectionStrings] <Hashtable> ] [[-HandlerMappings] <0, Culture=neutral, PublicKeyToken=31bf3856ad364e35> ] [[-ManagedPipelineMode] <String> {Classic | Integrated} ] [[-WebSocketsEnabled] <Boolean> ] [[-Use32BitWorkerProcess] <Boolean> ] [[-HostNames] <String[]> ] [ <CommonParameters>]
write-host "trying to stop azure website"
stop-azurewebsite nptesting
write-host "website stopped"
Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment