Merge pull request #48 from yahuijiang/master
Campaign Optimization Deploy Code
This commit is contained in:
Коммит
f0fbf0e5de
Двоичный файл не отображается.
|
@ -0,0 +1 @@
|
|||
#精准营销行业解决方案
|
|
@ -0,0 +1,242 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Deploys a template to Azure
|
||||
|
||||
.DESCRIPTION
|
||||
Deploys an Azure Resource Manager template
|
||||
|
||||
.PARAMETER subscriptionId
|
||||
The subscription id where the template will be deployed.
|
||||
|
||||
.PARAMETER resourceGroupName
|
||||
The resource group where the template will be deployed. Can be the name of an existing or a new resource group.
|
||||
|
||||
.PARAMETER resourceGroupLocation
|
||||
Optional, a resource group location. If specified, will try to create a new resource group in this location. If not specified, assumes resource group is existing.
|
||||
|
||||
.PARAMETER deploymentName
|
||||
The deployment name.
|
||||
|
||||
.PARAMETER templateFilePath
|
||||
Optional, path to the template file. Defaults to template.json.
|
||||
|
||||
.PARAMETER parametersFilePath
|
||||
Optional, path to the parameters file. Defaults to parameters.json. If file is not found, will prompt for parameter values based on template.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$subscriptionId,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$resourceGroupName,
|
||||
|
||||
[string]
|
||||
$resourceGroupLocation="China East",
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$deploymentName,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$VirtualMachineName,
|
||||
|
||||
# [Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$VMUser="azure",
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$VMPassword,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$SQLuser,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$SQLPassword,
|
||||
|
||||
<#
|
||||
[string]
|
||||
$WorkspaceCollectionName = "CampDemoPBIC",
|
||||
|
||||
[string]
|
||||
$WorkspaceName = "CampDemoPBIW",
|
||||
|
||||
[string]
|
||||
$PBIXdatasetname = "CampDemodataset",
|
||||
|
||||
[string]
|
||||
$PBIApiEndpoint = "https://api.powerbi.cn",
|
||||
|
||||
[string]
|
||||
$PBIXfilepath = "Camp.pbix",
|
||||
|
||||
[string]
|
||||
$webAppName = "SNADemoPbiEmbed",
|
||||
|
||||
[string]
|
||||
$servicePlanName ="CampDemo",
|
||||
|
||||
$Global:PackageName = "SNADemo",
|
||||
|
||||
$Global:PBIPackageName = "PowerBIEmbeded",
|
||||
#>
|
||||
|
||||
|
||||
[string]
|
||||
$templateFilePath = "template.json",
|
||||
|
||||
[string]
|
||||
$parametersFilePath = "parameters.json"
|
||||
)
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Registers RPs
|
||||
#>
|
||||
Function RegisterRP {
|
||||
Param(
|
||||
[string]$ResourceProviderNamespace
|
||||
)
|
||||
|
||||
Write-Host "Registering resource provider '$ResourceProviderNamespace'";
|
||||
Register-AzureRmResourceProvider -ProviderNamespace $ResourceProviderNamespace;
|
||||
}
|
||||
|
||||
|
||||
Function Check-AzureRmModule
|
||||
{
|
||||
#######################################################################
|
||||
# Verify Azure PowerShell module and version
|
||||
#######################################################################
|
||||
|
||||
# Import the Azure PowerShell module
|
||||
Write-Host "`n[WORKITEM] - Importing Azure PowerShell module" -ForegroundColor Yellow
|
||||
$azureModule = Import-Module Azure -PassThru
|
||||
|
||||
if ($azureModule -ne $null)
|
||||
{
|
||||
Write-Host "`tSuccess" -ForegroundColor Green
|
||||
}
|
||||
else
|
||||
{
|
||||
# Show module not found interaction and bail out
|
||||
Write-Host "[ERROR] - PowerShell module not found. Exiting." -ForegroundColor Red
|
||||
Exit
|
||||
}
|
||||
|
||||
# Check the Azure PowerShell module version
|
||||
Write-Host $azureModule.Version
|
||||
Write-Host "`n[WORKITEM] - Checking Azure PowerShell module verion" -ForegroundColor Yellow
|
||||
If ($azureModule.Version -ge (New-Object System.Version -ArgumentList "1.3.0"))
|
||||
{
|
||||
Write-Host "`tSuccess" -ForegroundColor Green
|
||||
}
|
||||
Else
|
||||
{
|
||||
Write-Host "[ERROR] - Azure PowerShell module must be version 1.3.0. Exiting." -ForegroundColor Red
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
Function Check-Net45
|
||||
{
|
||||
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full')
|
||||
{
|
||||
if (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release -ErrorAction SilentlyContinue)
|
||||
{
|
||||
|
||||
Write-Host ".Net Framework checking passed." -ForegroundColor Green
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "[ERROR] - .Net framework checking failed, please install .Net Frameowrk 4.5" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "[ERROR] - .Net framework checking failed, please install .Net Frameowrk 4.5" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
#******************************************************************************
|
||||
# Script body
|
||||
# Execution begins here
|
||||
#******************************************************************************
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Check-AzureRmModule
|
||||
Check-Net45
|
||||
|
||||
# sign in
|
||||
Write-Host "Logging in...";
|
||||
Login-AzureRmAccount -EnvironmentName AzureChinaCloud;
|
||||
|
||||
# select subscription
|
||||
Write-Host "Selecting subscription '$subscriptionId'";
|
||||
Select-AzureRmSubscription -SubscriptionID $subscriptionId;
|
||||
|
||||
|
||||
|
||||
# Register RPs
|
||||
$resourceProviders = @("microsoft.compute","microsoft.network","microsoft.storage");
|
||||
if($resourceProviders.length) {
|
||||
Write-Host "Registering resource providers"
|
||||
foreach($resourceProvider in $resourceProviders) {
|
||||
RegisterRP($resourceProvider);
|
||||
}
|
||||
}
|
||||
|
||||
#Create or check for existing resource group
|
||||
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
|
||||
if(!$resourceGroup)
|
||||
{
|
||||
Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
|
||||
if(!$resourceGroupLocation) {
|
||||
$resourceGroupLocation = Read-Host "resourceGroupLocation";
|
||||
}
|
||||
Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
|
||||
New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
|
||||
}
|
||||
else{
|
||||
Write-Host "Using existing resource group '$resourceGroupName'";
|
||||
}
|
||||
|
||||
#there is something wrong, the tickcount return a -1986045140,result in can not create storage account
|
||||
#$postfix = [System.Environment]::TickCount.ToString()
|
||||
$postfix = (0..9|Get-Random -count 10) -join $null
|
||||
$VMName = "$VirtualMachineName$postfix".ToLower()
|
||||
|
||||
if($VMName.Length -gt 15)
|
||||
{
|
||||
$VMName = $VMName.Substring(0,15).ToLower()
|
||||
Write-Host $VMName
|
||||
}
|
||||
|
||||
$newParametersPath = ".\newparameters.json"
|
||||
Write-Host "begin to generate real parameters file"
|
||||
|
||||
(Get-Content -Path $parametersFilePath) -replace("{{envname}}", $VMName.ToLower()) -replace("{{VMUser}}", $VMUser.ToLower()) -replace("{{password}}", $VMPassword) -replace("{{subscriptionId}}",$subscriptionId) -replace("{{sqluser}}",$SQLuser) -replace("{{sqlpassword}}",$SQLPassword)| Set-Content $newParametersPath
|
||||
|
||||
# Start the deployment
|
||||
Write-Host "Starting deployment..."
|
||||
|
||||
if(Test-Path $newParametersPath) {
|
||||
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $newParametersPath
|
||||
} else {
|
||||
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath
|
||||
}
|
||||
|
||||
#download demo script
|
||||
Write-Host "start download demo scrpit"
|
||||
|
||||
$files = @("https://yahuistorage2.blob.core.chinacloudapi.cn/campaign/r-server-campaign-optimization.zip","https://yahuistorage2.blob.core.chinacloudapi.cn/campaign/extension.ps1")
|
||||
Set-AzureRmVMCustomScriptExtension -ResourceGroupName $resourceGroupName -Location $resourceGroupLocation -VMName $VMName -Name "extensionscript" -FileUri $files -Run "extension.ps1" -Argument "-ServerName $VMName -DBName campaign -username $SQLuser -password $SQLPassword"
|
||||
Write-Host "install package success"
|
||||
exit
|
|
@ -0,0 +1,8 @@
|
|||
$path = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
Expand-Archive -Path $path\r-server-campaign-optimization.zip -Destination c:\
|
||||
cd c:\r-server-campaign-optimization\SQLR
|
||||
powershell -ExecutionPolicy Unrestricted -file c:\r-server-campaign-optimization\SQLR\Campaign_Optimization.ps1 $args
|
||||
#Write-Host "$args"
|
||||
#powershell -ExecutionPolicy Unrestricted -file e:\Campaign_Optimization.ps1 $args
|
||||
#Unzip-File -ZipFile r-server-campaign-optimization.zip -TargetFolder f:\test
|
||||
Write-Host "successed"
|
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"value": "chinaeast"
|
||||
},
|
||||
"virtualMachineName": {
|
||||
"value": "testcamp1904733"
|
||||
},
|
||||
"virtualMachineSize": {
|
||||
"value": "Standard_DS12_v2"
|
||||
},
|
||||
"adminUsername": {
|
||||
"value": "azure"
|
||||
},
|
||||
"virtualNetworkName": {
|
||||
"value": "testcamp1904733-vnet"
|
||||
},
|
||||
"networkInterfaceName": {
|
||||
"value": "testcamp1904733netinter"
|
||||
},
|
||||
"networkSecurityGroupName": {
|
||||
"value": "testcamp1904733-nsg"
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": "Passw0rd@123"
|
||||
},
|
||||
"storageAccountName": {
|
||||
"value": "testcamp1904733stor"
|
||||
},
|
||||
"diagnosticsStorageAccountName": {
|
||||
"value": "testcamp1904733dia"
|
||||
},
|
||||
"diagnosticsStorageAccountId": {
|
||||
"value": "Microsoft.Storage/storageAccounts/testcamp1904733dia"
|
||||
},
|
||||
"subnetName": {
|
||||
"value": "testcamp1904733subnet"
|
||||
},
|
||||
"subnetPrefix": {
|
||||
"value": "172.16.5.0/24"
|
||||
},
|
||||
"addressPrefix": {
|
||||
"value": "172.16.5.0/24"
|
||||
},
|
||||
"publicIpAddressName": {
|
||||
"value": "testcamp1904733-ip"
|
||||
},
|
||||
"publicIpAddressType": {
|
||||
"value": "Static"
|
||||
},
|
||||
"sqlConnectivityType": {
|
||||
"value": "Private"
|
||||
},
|
||||
"sqlPortNumber": {
|
||||
"value": 1433
|
||||
},
|
||||
"sqlStorageDisksCount": {
|
||||
"value": 1
|
||||
},
|
||||
"sqlStorageWorkloadType": {
|
||||
"value": "GENERAL"
|
||||
},
|
||||
"sqlStorageDisksConfigurationType": {
|
||||
"value": "NEW"
|
||||
},
|
||||
"sqlStorageStartingDeviceId": {
|
||||
"value": 2
|
||||
},
|
||||
"sqlStorageDeploymentToken": {
|
||||
"value": 77993
|
||||
},
|
||||
"sqlAutopatchingDayOfWeek": {
|
||||
"value": "Sunday"
|
||||
},
|
||||
"sqlAutopatchingStartHour": {
|
||||
"value": "2"
|
||||
},
|
||||
"sqlAutopatchingWindowDuration": {
|
||||
"value": "60"
|
||||
},
|
||||
"sqlAuthenticationLogin": {
|
||||
"value": "SqlAdmin"
|
||||
},
|
||||
"sqlAuthenticationPassword": {
|
||||
"value": "Passw0rd@123"
|
||||
},
|
||||
"rServicesEnabled": {
|
||||
"value": "true"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"value": "chinaeast"
|
||||
},
|
||||
"virtualMachineName": {
|
||||
"value": "{{envname}}"
|
||||
},
|
||||
"virtualMachineSize": {
|
||||
"value": "Standard_DS12_v2"
|
||||
},
|
||||
"adminUsername": {
|
||||
"value": "azure"
|
||||
},
|
||||
"virtualNetworkName": {
|
||||
"value": "{{envname}}-vnet"
|
||||
},
|
||||
"networkInterfaceName": {
|
||||
"value": "{{envname}}netinter"
|
||||
},
|
||||
"networkSecurityGroupName": {
|
||||
"value": "{{envname}}-nsg"
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": "{{password}}"
|
||||
},
|
||||
"storageAccountName": {
|
||||
"value": "{{envname}}stor"
|
||||
},
|
||||
"diagnosticsStorageAccountName": {
|
||||
"value": "{{envname}}dia"
|
||||
},
|
||||
"diagnosticsStorageAccountId": {
|
||||
"value": "Microsoft.Storage/storageAccounts/{{envname}}dia"
|
||||
},
|
||||
"subnetName": {
|
||||
"value": "{{envname}}subnet"
|
||||
},
|
||||
"subnetPrefix": {
|
||||
"value": "172.16.5.0/24"
|
||||
},
|
||||
"addressPrefix": {
|
||||
"value": "172.16.5.0/24"
|
||||
},
|
||||
"publicIpAddressName": {
|
||||
"value": "{{envname}}-ip"
|
||||
},
|
||||
"publicIpAddressType": {
|
||||
"value": "Static"
|
||||
},
|
||||
"sqlConnectivityType": {
|
||||
"value": "Private"
|
||||
},
|
||||
"sqlPortNumber": {
|
||||
"value": 1433
|
||||
},
|
||||
"sqlStorageDisksCount": {
|
||||
"value": 1
|
||||
},
|
||||
"sqlStorageWorkloadType": {
|
||||
"value": "GENERAL"
|
||||
},
|
||||
"sqlStorageDisksConfigurationType": {
|
||||
"value": "NEW"
|
||||
},
|
||||
"sqlStorageStartingDeviceId": {
|
||||
"value": 2
|
||||
},
|
||||
"sqlStorageDeploymentToken": {
|
||||
"value": 77993
|
||||
},
|
||||
"sqlAutopatchingDayOfWeek": {
|
||||
"value": "Sunday"
|
||||
},
|
||||
"sqlAutopatchingStartHour": {
|
||||
"value": "2"
|
||||
},
|
||||
"sqlAutopatchingWindowDuration": {
|
||||
"value": "60"
|
||||
},
|
||||
"sqlAuthenticationLogin": {
|
||||
"value": "{{sqluser}}"
|
||||
},
|
||||
"sqlAuthenticationPassword": {
|
||||
"value": "{{sqlpassword}}"
|
||||
},
|
||||
"rServicesEnabled": {
|
||||
"value": "true"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,340 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"virtualMachineName": {
|
||||
"type": "string"
|
||||
},
|
||||
"virtualMachineSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"virtualNetworkName": {
|
||||
"type": "string"
|
||||
},
|
||||
"networkInterfaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"networkSecurityGroupName": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring"
|
||||
},
|
||||
"storageAccountName": {
|
||||
"type": "string"
|
||||
},
|
||||
"diagnosticsStorageAccountName": {
|
||||
"type": "string"
|
||||
},
|
||||
"diagnosticsStorageAccountId": {
|
||||
"type": "string"
|
||||
},
|
||||
"subnetName": {
|
||||
"type": "string"
|
||||
},
|
||||
"publicIpAddressName": {
|
||||
"type": "string"
|
||||
},
|
||||
"publicIpAddressType": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlConnectivityType": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlPortNumber": {
|
||||
"type": "int"
|
||||
},
|
||||
"sqlStorageDisksCount": {
|
||||
"type": "int"
|
||||
},
|
||||
"sqlStorageWorkloadType": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlStorageDisksConfigurationType": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlStorageStartingDeviceId": {
|
||||
"type": "int"
|
||||
},
|
||||
"sqlStorageDeploymentToken": {
|
||||
"type": "int"
|
||||
},
|
||||
"sqlAutopatchingDayOfWeek": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlAutopatchingStartHour": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlAutopatchingWindowDuration": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlAuthenticationLogin": {
|
||||
"type": "string"
|
||||
},
|
||||
"sqlAuthenticationPassword": {
|
||||
"type": "securestring"
|
||||
},
|
||||
"rServicesEnabled": {
|
||||
"type": "string"
|
||||
},
|
||||
"addressPrefix": {
|
||||
"type": "string"
|
||||
},
|
||||
"subnetPrefix": {
|
||||
"type": "string"
|
||||
},
|
||||
},
|
||||
"variables": {
|
||||
"vnetId": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"name": "[parameters('virtualMachineName')]",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"apiVersion": "2016-03-30",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('virtualMachineName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"windowsConfiguration": {
|
||||
"provisionVmAgent": "true"
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('virtualMachineSize')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "MicrosoftSQLServer",
|
||||
"offer": "SQL2016SP1-WS2016",
|
||||
"sku": "Enterprise",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"createOption": "fromImage",
|
||||
"vhd": {
|
||||
"uri": "[concat(concat(reference(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2015-06-15').primaryEndpoints['blob'], 'vhds/'), parameters('virtualMachineName'), '20170704132028.vhd')]"
|
||||
},
|
||||
"name": "[parameters('virtualMachineName')]"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"createOption": "empty",
|
||||
"lun": 0,
|
||||
"diskSizeGB": "1023",
|
||||
"caching": "ReadOnly",
|
||||
"name": "[concat(parameters('virtualMachineName'), '-disk-1')]",
|
||||
"vhd": {
|
||||
"uri": "[concat(concat(reference(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2015-06-15').primaryEndpoints['blob'], 'vhds/'), parameters('virtualMachineName'), '-disk-1-20170704132028', '.vhd')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": true,
|
||||
"storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts', parameters('diagnosticsStorageAccountName')), '2015-06-15').primaryEndpoints['blob']]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||
"name": "[concat(parameters('virtualMachineName'), '/SqlIaasExtension')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]",
|
||||
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"type": "SqlIaaSAgent",
|
||||
"publisher": "Microsoft.SqlServer.Management",
|
||||
"typeHandlerVersion": "1.2",
|
||||
"autoUpgradeMinorVersion": "true",
|
||||
"settings": {
|
||||
"AutoTelemetrySettings": {
|
||||
"Region": "[parameters('location')]"
|
||||
},
|
||||
"AutoPatchingSettings": {
|
||||
"PatchCategory": "WindowsMandatoryUpdates",
|
||||
"Enable": true,
|
||||
"DayOfWeek": "[parameters('sqlAutopatchingDayOfWeek')]",
|
||||
"MaintenanceWindowStartingHour": "[parameters('sqlAutopatchingStartHour')]",
|
||||
"MaintenanceWindowDuration": "[parameters('sqlAutopatchingWindowDuration')]"
|
||||
},
|
||||
"KeyVaultCredentialSettings": {
|
||||
"Enable": false,
|
||||
"CredentialName": ""
|
||||
},
|
||||
"ServerConfigurationsManagementSettings": {
|
||||
"SQLConnectivityUpdateSettings": {
|
||||
"ConnectivityType": "[parameters('sqlConnectivityType')]",
|
||||
"Port": "[parameters('sqlPortNumber')]"
|
||||
},
|
||||
"SQLWorkloadTypeUpdateSettings": {
|
||||
"SQLWorkloadType": "[parameters('sqlStorageWorkloadType')]"
|
||||
},
|
||||
"SQLStorageUpdateSettings": {
|
||||
"DiskCount": "[parameters('sqlStorageDisksCount')]",
|
||||
"NumberOfColumns": "[parameters('sqlStorageDisksCount')]",
|
||||
"StartingDeviceID": "[parameters('sqlStorageStartingDeviceId')]",
|
||||
"DiskConfigurationType": "[parameters('sqlStorageDisksConfigurationType')]"
|
||||
},
|
||||
"AdditionalFeaturesServerConfigurations": {
|
||||
"IsRServicesEnabled": "[parameters('rServicesEnabled')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"protectedSettings": {
|
||||
"SQLAuthUpdateUserName": "[parameters('sqlAuthenticationLogin')]",
|
||||
"SQLAuthUpdatePassword": "[parameters('sqlAuthenticationPassword')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[parameters('networkInterfaceName')]",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"apiVersion": "2016-09-01",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]",
|
||||
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIpAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"networkSecurityGroup": {
|
||||
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[parameters('publicIpAddressName')]",
|
||||
"type": "Microsoft.Network/publicIpAddresses",
|
||||
"apiVersion": "2016-09-01",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"publicIpAllocationMethod": "[parameters('publicIpAddressType')]"
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('virtualMachineName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[parameters('networkSecurityGroupName')]",
|
||||
"type": "Microsoft.Network/networkSecurityGroups",
|
||||
"apiVersion": "2016-09-01",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"securityRules": [
|
||||
{
|
||||
"name": "default-allow-rdp",
|
||||
"properties": {
|
||||
"priority": 1000,
|
||||
"sourceAddressPrefix": "*",
|
||||
"protocol": "TCP",
|
||||
"destinationPortRange": "3389",
|
||||
"access": "Allow",
|
||||
"direction": "Inbound",
|
||||
"sourcePortRange": "*",
|
||||
"destinationAddressPrefix": "*"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"sku": {
|
||||
"name": "Premium_LRS",
|
||||
"tier": "Premium"
|
||||
},
|
||||
"kind": "Storage",
|
||||
"name": "[parameters('storageAccountName')]",
|
||||
"apiVersion": "2016-01-01",
|
||||
"location": "[parameters('location')]",
|
||||
"tags": {},
|
||||
"scale": null,
|
||||
"properties": {},
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"sku": {
|
||||
"name": "Standard_LRS",
|
||||
"tier": "Standard"
|
||||
},
|
||||
"kind": "Storage",
|
||||
"name": "[parameters('diagnosticsStorageAccountName')]",
|
||||
"apiVersion": "2016-01-01",
|
||||
"location": "[parameters('location')]",
|
||||
"tags": {},
|
||||
"scale": null,
|
||||
"properties": {},
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[parameters('virtualNetworkName')]",
|
||||
"apiVersion": "2016-03-30",
|
||||
"location": "[parameters('location')]",
|
||||
"scale": null,
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[parameters('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[parameters('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[parameters('addressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependsOn": []
|
||||
}
|
||||
|
||||
],
|
||||
"outputs": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"value": "[parameters('adminUsername')]"
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 101 KiB |
|
@ -0,0 +1,41 @@
|
|||
# 精准营销解决方案--营销方案优化
|
||||
区别于传统营销活动单纯利用基于经验的固定规则,精准营销方案利用 Azure 机器学习算法对商家的历史销售数据进行分析,建立预测模型对营销活动转化率进行预测,并将预测结果转化为营销建议,提高营销活动转化率。建议维度包括顾客联系渠道(邮件、短信和电话)、最佳联系时间(一周中某天的某个时段)等。
|
||||
|
||||
## 场景描述
|
||||
基于历史营销数据,通过建立机器模型来预测针对不同的客户在不同的时间段,通过不同渠道的营销转化率,从而提高营销活动的转化率。
|
||||
|
||||
## 技术架构
|
||||
解决方案架构图如下:
|
||||
![Solution Diagram](./Pictures/Arch.JPG)
|
||||
|
||||
解决方案展示了利用SQL Server 2016 和 R Services在通过对历史数据的分析,根据不同的潜在客户给出不同的行动方案,从而来提高一个营销活动中目标潜在客户的购买率。
|
||||
通过使用powerBI 做一个直观的展示。
|
||||
|
||||
## PowerBI 演示
|
||||
通过powerBI不仅可以直观的看到当前活动的建议,还可以看到用于训练模型的历史数据。
|
||||
campaingn Summary 表展示的是历史数据,这些数据用于训练机器模型来预测活动的转化率。
|
||||
Recommendation 表显示的是针对下一次的活动,机器模型给出的建议。
|
||||
## 部署包
|
||||
解决方案提供给可以部署在自有Azured订阅的解决方案部署包,用户可以一键部署本解决方案,从而深入了解如何利用Azure服务来实现业务场景。
|
||||
|
||||
### 部署前提
|
||||
进行精准营销的解决方案的时,已默认具有以下的条件:
|
||||
|
||||
1. 具有Azure中国的订阅账号
|
||||
2. 订阅账号中有以下的资源配额和权限
|
||||
i. 能够创建存储账号
|
||||
ii. 能够创建SQL Server 服务器
|
||||
3. 系统安装Azure SDK 和PowerShell 5.0
|
||||
4. 具有powerBI的订阅用于制作报表
|
||||
### 部署
|
||||
1. 打开PowerShell,切换当前文件夹到DeployPkg下
|
||||
2. 运行deploy.ps1
|
||||
3. 在弹出的登录框中输入Azure订阅的用户名和密码,验证登录。
|
||||
4. 根据提示输入相关的信息,注意
|
||||
a. 输入数据库服务器的用户名azure会有安全性的限制,比如azure,sa不能作为该用户名。
|
||||
b. 数据库服务器密码,需要最短8位,包含大小写字母,数字及特殊字符,如Passw0rd!。
|
||||
5. 等待程序运行结束
|
||||
部署完成之后,可以登录到Azure portal中查看相应的资源信息,可以通过连接对应的数据库来查看相关的数据。
|
||||
|
||||
## 源代码
|
||||
源代码相关请参考: https://github.com/Microsoft/r-server-campaign-optimization/tree/master/SQLR
|
Загрузка…
Ссылка в новой задаче