-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Decouple Sql project with Storage in ASM; #1965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
83e7ee8
78b8c94
0c73afe
24fe230
0b248c3
3ace6df
abc8d02
b57e776
d05b2ad
0925732
ba81733
6b1c034
29c0914
6e09d3c
a16c230
ea86c0f
e8dc8cb
edbe071
1671bfb
a4f4c20
3b4053b
c2c997e
cfe358a
5f27e2f
6ff09fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,16 +13,14 @@ | |
|
|
||
| using System; | ||
| using System.Management.Automation; | ||
| using Microsoft.WindowsAzure.Commands.Common; | ||
| using Microsoft.Azure.Commands.Common.Authentication.Models; | ||
| using Microsoft.WindowsAzure.Commands.Common.Storage; | ||
| using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; | ||
| using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; | ||
| using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; | ||
| using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; | ||
| using Microsoft.WindowsAzure.Management.Sql; | ||
| using Microsoft.WindowsAzure.Management.Sql.Models; | ||
| using Microsoft.Azure.Commands.Common.Authentication; | ||
| using Microsoft.WindowsAzure.Storage.Blob; | ||
|
|
||
| namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet | ||
| { | ||
|
|
@@ -66,7 +64,7 @@ public class StartAzureSqlDatabaseImport : SqlDatabaseCmdletBase | |
| ParameterSetName = ByContainerObjectParameterSet, | ||
| HelpMessage = "The Azure Storage Container to place the blob in.")] | ||
| [ValidateNotNull] | ||
| public AzureStorageContainer StorageContainer { get; set; } | ||
| public CloudBlobContainer StorageContainer { get; set; } | ||
|
||
|
|
||
| /// <summary> | ||
| /// Gets or sets the storage context | ||
|
|
@@ -202,7 +200,7 @@ public override void ExecuteCmdlet() | |
| try | ||
| { | ||
| // Obtain the Blob Uri and Access Key | ||
| string blobUri = null; | ||
| Uri blobUri = null; | ||
| string accessKey = null; | ||
| switch (this.ParameterSetName) | ||
| { | ||
|
|
@@ -212,20 +210,15 @@ public override void ExecuteCmdlet() | |
| this.StorageContext.StorageAccount.Credentials.ExportKey()); | ||
|
|
||
| blobUri = | ||
| this.StorageContext.BlobEndPoint + | ||
| this.StorageContainerName + "/" + | ||
| this.BlobName; | ||
| this.StorageContext.StorageAccount.CreateCloudBlobClient().GetContainerReference(this.StorageContainerName).GetBlobReference(this.BlobName).SnapshotQualifiedUri; | ||
| break; | ||
|
|
||
| case ByContainerObjectParameterSet: | ||
| accessKey = | ||
| System.Convert.ToBase64String( | ||
| this.StorageContainer.CloudBlobContainer.ServiceClient.Credentials.ExportKey()); | ||
| this.StorageContainer.ServiceClient.Credentials.ExportKey()); | ||
|
|
||
| blobUri = | ||
| this.StorageContainer.Context.BlobEndPoint + | ||
| this.StorageContainer.Name + "/" + | ||
| this.BlobName; | ||
| blobUri = this.StorageContainer.GetBlobReference(this.BlobName).SnapshotQualifiedUri; | ||
| break; | ||
|
|
||
| default: | ||
|
|
@@ -239,7 +232,7 @@ public override void ExecuteCmdlet() | |
| // Issue the request | ||
| ImportExportRequest context = this.ImportSqlAzureDatabaseProcess( | ||
| this.SqlConnectionContext.ServerName, | ||
| new Uri(blobUri), | ||
| blobUri, | ||
| accessKey, | ||
| fullyQualifiedServerName, | ||
| this.DatabaseName, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a breaking change - I'm concerned about the differences between creating an AzureStorageConatiner and a CloudBlobContainer. Does this break any piping scenarios? What does it look like for a customer to create this parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. I've confirmed with Sql team and they've agreed with this change. Current, this parameter doesn't support pipeline, so the change won't break any piping scenarios. CloudBlobContainer can be got with Get-AzureStorageContainer cmdlet too, I've updated examples in help.