diff --git a/src/ResourceManagement/Compute/Domain/InterfaceImpl/SnapshotImpl.cs b/src/ResourceManagement/Compute/Domain/InterfaceImpl/SnapshotImpl.cs
index ff841e5c5..6de560639 100644
--- a/src/ResourceManagement/Compute/Domain/InterfaceImpl/SnapshotImpl.cs
+++ b/src/ResourceManagement/Compute/Domain/InterfaceImpl/SnapshotImpl.cs
@@ -170,10 +170,11 @@ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithDataSnapshotFromSnapsho
/// Specifies the source data VHD.
///
/// A source VHD URL.
+ /// A storage account ID.
/// The next stage of the definition.
- Snapshot.Definition.IWithCreate Snapshot.Definition.IWithDataSnapshotFromVhd.WithDataFromVhd(string vhdUrl)
+ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithDataSnapshotFromVhd.WithDataFromVhd(string vhdUrl, string storageAccountId)
{
- return this.WithDataFromVhd(vhdUrl);
+ return this.WithDataFromVhd(vhdUrl, storageAccountId);
}
///
@@ -220,10 +221,11 @@ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithLinuxSnapshotSource.Wit
/// Specifies the source specialized or generalized Linux OS VHD.
///
/// The source VHD URL.
+ /// The storage account ID.
/// The next stage of the definition.
- Snapshot.Definition.IWithCreate Snapshot.Definition.IWithLinuxSnapshotSource.WithLinuxFromVhd(string vhdUrl)
+ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithLinuxSnapshotSource.WithLinuxFromVhd(string vhdUrl, string storageAccountId)
{
- return this.WithLinuxFromVhd(vhdUrl);
+ return this.WithLinuxFromVhd(vhdUrl, storageAccountId);
}
///
@@ -342,10 +344,11 @@ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithWindowsSnapshotSource.W
/// Specifies the source specialized or generalized Windows OS VHD.
///
/// The source VHD URL.
+ /// The storage account ID.
/// The next stage of the definition.
- Snapshot.Definition.IWithCreate Snapshot.Definition.IWithWindowsSnapshotSource.WithWindowsFromVhd(string vhdUrl)
+ Snapshot.Definition.IWithCreate Snapshot.Definition.IWithWindowsSnapshotSource.WithWindowsFromVhd(string vhdUrl, string storageAccountId)
{
- return this.WithWindowsFromVhd(vhdUrl);
+ return this.WithWindowsFromVhd(vhdUrl, storageAccountId);
}
}
}
\ No newline at end of file
diff --git a/src/ResourceManagement/Compute/Domain/Snapshot/Definition/IDefinition.cs b/src/ResourceManagement/Compute/Domain/Snapshot/Definition/IDefinition.cs
index b94deef2c..b02b19598 100644
--- a/src/ResourceManagement/Compute/Domain/Snapshot/Definition/IDefinition.cs
+++ b/src/ResourceManagement/Compute/Domain/Snapshot/Definition/IDefinition.cs
@@ -217,11 +217,12 @@ public interface IWithLinuxSnapshotSource
Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithLinuxFromSnapshot(ISnapshot sourceSnapshot);
///
- /// Specifies the source specialized or generalized Linux OS VHD.
+ /// Specifies the source specialized or generalized Linux OS VHD and the storage account ID.
///
/// The source VHD URL.
+ /// The storage account ID.
/// The next stage of the definition.
- Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithLinuxFromVhd(string vhdUrl);
+ Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithLinuxFromVhd(string vhdUrl, string storageAccountId = default(string));
}
///
@@ -277,11 +278,12 @@ public interface IWithWindowsSnapshotSource
Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithWindowsFromSnapshot(ISnapshot sourceSnapshot);
///
- /// Specifies the source specialized or generalized Windows OS VHD.
+ /// Specifies the source specialized or generalized Windows OS VHD and the storage account ID.
///
/// The source VHD URL.
+ /// The storage account ID.
/// The next stage of the definition.
- Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithWindowsFromVhd(string vhdUrl);
+ Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithWindowsFromVhd(string vhdUrl, string storageAccountId = default(string));
}
///
@@ -322,10 +324,11 @@ public interface IWithDataSnapshotFromVhd
{
///
- /// Specifies the source data VHD.
+ /// Specifies the source data VHD and the storage account ID.
///
- /// A source VHD URL.
+ /// The source VHD URL.
+ /// The storage account ID.
/// The next stage of the definition.
- Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithDataFromVhd(string vhdUrl);
+ Microsoft.Azure.Management.Compute.Fluent.Snapshot.Definition.IWithCreate WithDataFromVhd(string vhdUrl, string storageAccountId = default(string));
}
}
\ No newline at end of file
diff --git a/src/ResourceManagement/Compute/Generated/Models/CreationData.cs b/src/ResourceManagement/Compute/Generated/Models/CreationData.cs
index b6906b380..3c62f5897 100644
--- a/src/ResourceManagement/Compute/Generated/Models/CreationData.cs
+++ b/src/ResourceManagement/Compute/Generated/Models/CreationData.cs
@@ -75,7 +75,7 @@ public CreationData()
///
/// Gets or sets if createOption is Import, the Azure Resource Manager
/// identifier of the storage account containing the blob to import as
- /// a disk. Required only if the blob is in a different subscription
+ /// a disk.
///
[JsonProperty(PropertyName = "storageAccountId")]
public string StorageAccountId { get; set; }
diff --git a/src/ResourceManagement/Compute/SnapshotImpl.cs b/src/ResourceManagement/Compute/SnapshotImpl.cs
index 222677db7..d0f420692 100644
--- a/src/ResourceManagement/Compute/SnapshotImpl.cs
+++ b/src/ResourceManagement/Compute/SnapshotImpl.cs
@@ -7,6 +7,7 @@ namespace Microsoft.Azure.Management.Compute.Fluent
using Models;
using ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
+ using System;
///
/// The implementation for Snapshot and its create and update interfaces.
@@ -70,12 +71,15 @@ public SnapshotImpl WithIncremental(bool enabled)
}
///GENMHASH:AAD8E592A024E583CCB079E40FA35511:86D949645392B88CC8EBDF08E3E0EDF8
- public SnapshotImpl WithLinuxFromVhd(string vhdUrl)
+ public SnapshotImpl WithLinuxFromVhd(string vhdUrl, string storageAccountId)
{
Inner.OsType = OperatingSystemTypes.Linux;
- Inner.CreationData = new CreationData();
- Inner.CreationData.CreateOption = DiskCreateOption.Import;
- Inner.CreationData.SourceUri = vhdUrl;
+ Inner.CreationData = new CreationData
+ {
+ CreateOption = DiskCreateOption.Import,
+ SourceUri = vhdUrl,
+ StorageAccountId = storageAccountId ?? ConstructStorageAccountId(vhdUrl)
+ };
return this;
}
@@ -180,11 +184,14 @@ public CreationSource Source()
}
///GENMHASH:BE7E147B48A8E5D7518DE00A1A239664:B42B6D1380F4A7780F5B729A33312605
- public SnapshotImpl WithDataFromVhd(string vhdUrl)
+ public SnapshotImpl WithDataFromVhd(string vhdUrl, string storageAccountId)
{
- Inner.CreationData = new CreationData();
- Inner.CreationData.CreateOption = DiskCreateOption.Import;
- Inner.CreationData.SourceUri = vhdUrl;
+ Inner.CreationData = new CreationData
+ {
+ CreateOption = DiskCreateOption.Import,
+ SourceUri = vhdUrl,
+ StorageAccountId = storageAccountId ?? ConstructStorageAccountId(vhdUrl)
+ };
return this;
}
@@ -199,12 +206,15 @@ public DiskCreateOption CreationMethod()
}
///GENMHASH:28C892DD6868506954A9B3D406FE4710:E57D05C8BB272E6441E14E0F73F93F60
- public SnapshotImpl WithWindowsFromVhd(string vhdUrl)
+ public SnapshotImpl WithWindowsFromVhd(string vhdUrl, string storageAccountId)
{
Inner.OsType = OperatingSystemTypes.Windows;
- Inner.CreationData = new CreationData();
- Inner.CreationData.CreateOption = DiskCreateOption.Import;
- Inner.CreationData.SourceUri = vhdUrl;
+ Inner.CreationData = new CreationData
+ {
+ CreateOption = DiskCreateOption.Import,
+ SourceUri = vhdUrl,
+ StorageAccountId = storageAccountId ?? ConstructStorageAccountId(vhdUrl)
+ };
return this;
}
@@ -338,5 +348,22 @@ public SnapshotImpl WithLinuxFromSnapshot(ISnapshot sourceSnapshot)
SetInner(snapshotInner);
return this;
}
+
+ internal string ConstructStorageAccountId(string vhdUrl)
+ {
+ try
+ {
+ return ResourceUtils.ConstructResourceId(Manager.SubscriptionId,
+ ResourceGroupName,
+ "Microsoft.Storage",
+ "storageAccounts",
+ vhdUrl.Split('.')[0].Replace("https://", ""),
+ "");
+ }
+ catch (Exception)
+ {
+ throw new ArgumentException(string.Format("%s is not valid URI of a blob to import.", vhdUrl));
+ }
+ }
}
}
\ No newline at end of file