From 5e145b4c94b0b9ba1e5577bf74aa3937a228b97b Mon Sep 17 00:00:00 2001 From: Graham Williams Date: Mon, 27 Feb 2017 10:10:30 +0800 Subject: [PATCH] Remove DeleteRG since hardly worth its own vignette. Intead introduce test folder for test scripts. --- vignettes/DeleteRG.Rmd | 105 ----------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 vignettes/DeleteRG.Rmd diff --git a/vignettes/DeleteRG.Rmd b/vignettes/DeleteRG.Rmd deleted file mode 100644 index c70750a..0000000 --- a/vignettes/DeleteRG.Rmd +++ /dev/null @@ -1,105 +0,0 @@ ---- -title = "Using Azure Data Science Resources: Delete a Resource Group" -author= "Graham Williams" ---- - -# Use Case - -A sample deployment of a Linux Data Science Virtual Machine (DSVM) is -presented in the -[AzureDSR's Deploy DSMV](https://github.com/Azure/AzureDSR/blob/master/vignettes/DeployDSVM.Rmd) -document. All of the resources (the virtual machine, public IP -address, network interface, storage account, network security group, -and virtual network) will be hosted within a single resource -group. Thus it is convenient to simply delete the resource group to -remove the deployment of the DSVM. - -This script can be run after the -[AzureDSR's Deploy DSMV](https://github.com/Azure/AzureDSR/blob/master/vignettes/DeployDSVM.Rmd) -script to delete all resources created in that script. - -# Preparation - -We assume the user already has an Azure subscription and we have -obtained the credentials required. See -[AzureSMR's Authentication Guide](https://github.com/Microsoft/AzureSMR/blob/master/vignettes/Authentication.Rmd) -for details. We will then ensure the resource group exists and then -delete it. - -# Setup - -To get started we need to load our Azure credentials. - -```{r credentials, eval=FALSE} -# Credentials come from app creation in Active Directory within Azure. - -TID <- "72f9....db47" # Tenant ID -CID <- "9c52....074a" # Client ID -KEY <- "9Efb....4nwV....ASa8=" # User key - -``` - -We might be able to load such information from the file -_credentials.R where is replaced with your username. - -```{r setup} -# Load the required subscription resources: TID, CID, and KEY. - -USER <- Sys.getenv("USER") - -source(paste0(USER, "_credentials.R")) - -# Install the packages if required. - -## devtools::install_github("Microsoft/AzureSMR") -## devtools::install_github("Azure/AzureDSR", auth_token=GIT_TOKEN) -``` - -```{r packages} -# Load the required packages. - -library(AzureSMR) # Support for managing Azure resources. -library(AzureDSR) # Further support for the Data Scientist. -library(magrittr) -library(dplyr) -``` - -```{r tuning} -# Parameters for this script: the name for the new resource group and -# its location across the Azure cloud. The resource name is used to -# name the resource group that we will create transiently for the -# purposes of this script. - -RG <- "my_dsvm_rg_sea" # The resource group to be deleted. -``` - -```{r connect} -# Connect to the Azure subscription and use this as the context for -# our activities. - -context <- createAzureContext(tenantID=TID, clientID=CID, authKey=KEY) - -# Check if the resource group already exists. Take note this script -# will not remove the resource group if it pre-existed. - -rg_pre_exists <- existsRG(context, RG, LOC) - -``` - -# Delete the Resource Group - -Delete the resource group within which all resources were created. - -```{r create resource group} -if (rg_pre_exists) -{ - # Delete the resource group RG. - - # Note that to delete a resource group can take some time, like 10 minutes. - - azureDeleteResourceGroup(context, RG) - -} -``` - -Once deleted we are consuming no more.