Skip to content

Commit

Permalink
Merge pull request #220 from microsoft/alex/hybridtoolkitbook
Browse files Browse the repository at this point in the history
Azure SQL Hybrid Cloud Toolkit Jupyter Book addition
  • Loading branch information
smartguest authored Nov 11, 2020
2 parents d8a3405 + ce0ef01 commit 4c2594c
Show file tree
Hide file tree
Showing 79 changed files with 8,622 additions and 0 deletions.
63 changes: 63 additions & 0 deletions SQL-Hybrid-Cloud-Toolkit/Components/ADP/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
161 changes: 161 additions & 0 deletions SQL-Hybrid-Cloud-Toolkit/Components/ADP/ADPControl.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"metadata": {
"kernelspec": {
"name": "powershell",
"display_name": "PowerShell"
},
"language_info": {
"name": "powershell",
"codemirror_mode": "shell",
"mimetype": "text/x-sh",
"file_extension": ".ps1"
}
},
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": [
"# 0. Preparing the Credential"
],
"metadata": {
"azdata_cell_guid": "140ce3a4-9596-47b5-ad22-87c3bd2057f6"
}
},
{
"cell_type": "code",
"source": [
"$functionKey = 'yourAzureFunctionKey'\r\n",
"$Login = 'yourSqlServerLogin'\r\n",
"$Password = 'yourSqlServerPassword'\r\n",
"\r\n",
"$headers = @{\r\n",
" 'x-functions-key' = $functionKey\r\n",
"}"
],
"metadata": {
"azdata_cell_guid": "36fa6902-7640-462d-bc2e-6b49e9aaa0d9",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"# 1. Calling the ADP Orchestrator (Export)\r\n",
"## 1.1 Submit the Export request to the source Azure SQL Server."
],
"metadata": {
"azdata_cell_guid": "40c4517b-8145-4af1-bbbb-3be3b9b9a8a0"
}
},
{
"cell_type": "code",
"source": [
"$Url = 'https://adpcontrol.azurewebsites.net/api/subscriptions/0009fc4d-e310-4e40-8e63-c48a23e9cdc1/resourceGroups/seanadp01/Export'\n",
"\n",
"$Body = @{\n",
" batchAccountUrl = 'https://adp.eastus.batch.azure.com'\n",
" storageAccountName = 'adp01batch'\n",
" sourceSqlServerResourceGroupName = 'SeanADP01Source'\n",
" sourceSqlServerName = 'adpsvr01'\n",
" userName = $Login \n",
" password = $Password \n",
"}\n",
"\n",
"$json = $Body | ConvertTo-Json\n",
"$exportResponse = Invoke-RestMethod -Method 'Post' -Headers $headers -Uri $Url -Body $json -ContentType 'application/json'\n",
"$exportResponse"
],
"metadata": {
"azdata_cell_guid": "7e1d3261-5e61-4106-8063-7cd58ffd0cf1",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"## 1.2 Getting the Operation Status"
],
"metadata": {
"azdata_cell_guid": "52204c15-abad-4ce5-8629-d290332f730b"
}
},
{
"cell_type": "code",
"source": [
"Invoke-RestMethod -Method 'Get' -Uri $exportResponse.statusQueryGetUri"
],
"metadata": {
"azdata_cell_guid": "a0ba1261-3a26-4168-b149-1b9e44939432",
"tags": [
"hide_input"
]
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"# 2. Calling the ADP Orchestrator (Import)\r\n",
"## 2.1 Submit the Import request to the target Azure SQL Server."
],
"metadata": {
"azdata_cell_guid": "2c862275-c380-476a-ab3d-a9aacdca963b"
}
},
{
"cell_type": "code",
"source": [
"$Url = 'https://adpcontrol.azurewebsites.net/api/subscriptions/0009fc4d-e310-4e40-8e63-c48a23e9cdc1/resourceGroups/seanadp01/Import'\r\n",
"$Body = @{\r\n",
" batchAccountUrl = 'https://adp.eastus.batch.azure.com'\r\n",
" storageAccountName = 'adp01batch'\r\n",
" containerName = 'adpsvr01-0428061710'\r\n",
" targetSqlServerResourceGroupName = 'SeanADP01Target'\r\n",
" targetSqlServerName = 'adpsvr03'\r\n",
" userName = $Login \r\n",
" password = $Password \r\n",
"}\r\n",
"\r\n",
"$json = $Body | ConvertTo-Json\r\n",
"$importResponse = Invoke-RestMethod -Method 'Post' -Headers $headers -Uri $Url -Body $json -ContentType 'application/json'\r\n",
"$importResponse"
],
"metadata": {
"azdata_cell_guid": "315859aa-e452-4ab3-acb5-92c7c8bd5857",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"## 2.2 Getting the Operation Status"
],
"metadata": {
"azdata_cell_guid": "5da3293b-7d10-4315-8106-79e56cd657ea"
}
},
{
"cell_type": "code",
"source": [
"Invoke-RestMethod -Method 'Get' -Uri $importResponse.statusQueryGetUri"
],
"metadata": {
"azdata_cell_guid": "328d3a27-4cdf-4623-a8c5-8230487efbed",
"tags": [
"hide_input"
]
},
"outputs": [],
"execution_count": null
}
]
}
37 changes: 37 additions & 0 deletions SQL-Hybrid-Cloud-Toolkit/Components/ADP/ADPControl.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ADPControl", "ADPControl\ADPControl.csproj", "{6309D4C5-F118-4C89-A67E-E557CA41ABA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchWrapper", "BatchWrapper\BatchWrapper.csproj", "{E64CD92E-2D2C-48F1-B6B1-A7AF819B06F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlPackageWrapper", "SqlPackageWrapper\SqlPackageWrapper.csproj", "{A19335D3-9D80-43BE-9351-C3C3704689B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6309D4C5-F118-4C89-A67E-E557CA41ABA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6309D4C5-F118-4C89-A67E-E557CA41ABA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6309D4C5-F118-4C89-A67E-E557CA41ABA2}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{6309D4C5-F118-4C89-A67E-E557CA41ABA2}.Release|Any CPU.Build.0 = Debug|Any CPU
{E64CD92E-2D2C-48F1-B6B1-A7AF819B06F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E64CD92E-2D2C-48F1-B6B1-A7AF819B06F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E64CD92E-2D2C-48F1-B6B1-A7AF819B06F1}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{E64CD92E-2D2C-48F1-B6B1-A7AF819B06F1}.Release|Any CPU.Build.0 = Debug|Any CPU
{A19335D3-9D80-43BE-9351-C3C3704689B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A19335D3-9D80-43BE-9351-C3C3704689B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A19335D3-9D80-43BE-9351-C3C3704689B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A19335D3-9D80-43BE-9351-C3C3704689B0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3DB5F0CB-1D26-4E33-801D-7BBAE823C39D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Batch" Version="13.0.0" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.7.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.5.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.2.2" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.21" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Loading

0 comments on commit 4c2594c

Please sign in to comment.