Download the downloaded cspkg file from Azure

Is it possible to download cspkg from Azure that I downloaded (instead of re-downloading the new package)?

Script -

I need to add files to an existing website - say, an image.

I rdp and add manually; however, Azure will recreate the new instance and destroy my files when my instance behaves so abnormally.

(Ideally, I should store them in a repository, but that is not the issue.)

Thank you for your advice!

+7
source share
3 answers

[Paragraph below]

There is currently no API or mechanism that can download the same CSPKG directly from the downloaded Windows Azure portal. This is very important for Windows Azure users, especially if you lose your Windows Azure project / solution.

[Edit-Correction to above paragraph]

Using the Get Package REST API, you can download the package from a specific deployment in the Azure Blog repository. If you decide to write your own C # application to use the REST API, a sample is here . If you don't want to write an API and just download the package using a REST call, there are several tools and I used BURP (Java based) as described in my blog here . You can use the information in the blog to establish a connection with the Azure Portal, and then use the REST call as described to receive the package.

Further, even if you download CSPKG (or have a local copy of CSPKG), you cannot edit it by adding or removing any content directly, because this will violate the integrity of the CSPKG package, and you will get an error message, The package must be created using the tool Cspack.

The E: \ drive, where your approach contains most of your compiled code, so if you can download it locally and come up with the idea of ​​creating a new project form (???), this could be an option, if the package was created directly using the CSPACK tool and downloading files from the E: \ drive and rebuilding the package really works, but if the project is a complex application that included source and compiled code files, that is, an ASP.NET/MVCx application, it’s complicated,

+5
source

I ran into a similar problem,

What I've done,

Use the Get-Package API REST API to store cspkg and cscfg in a storage container.

Remember that this storage container must be under the same signature, otherwise the Get-Package API calls will not be executed.

Then I used AzCopy ( http://blogs.msdn.com/b/windowsazurestorage/archive/2012/12/03/azcopy-uploading-downloading-files-for-windows-azure-blobs.aspx ) to copy files from storage container to my local drives.

You can also use AzCopy to copy from one StorageContainer to another, even under different subscriptions.

Let me know if you need more information.

+2
source

Using the Windows Azure Service Management Library NuGet package, C # code to get the package:

 private static X509Certificate2 GetCertificate(string storeName, string thumbprint) { var store = new X509Store(storeName); store.Open(OpenFlags.ReadOnly); return store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, true)[0]; } public static void ExportPackage(X509Certificate2 certificate, string subscriptionId, string serviceName, string deploymentName, string containerUri) { var managementService = ServiceManagementHelper.CreateServiceManagementChannel("WindowsAzureEndPoint", certificate); try { managementService.GetPackage( subscriptionId, serviceName, deploymentName, containerUri, true /*overwriteExisting*/); } catch (Exception ex) { System.Net.WebException exception = ex.InnerException as System.Net.WebException; if (exception != null) { string responseText; using (var reader = new System.IO.StreamReader(exception.Response.GetResponseStream())) { responseText = reader.ReadToEnd(); Console.WriteLine("ERROR:" + exception); Console.WriteLine(responseText); } } } } 

My problem, however, is that no matter what I pass as the Uri container, I return 400 Bad request - the value of the parameter "something.blob.core.windows.net/somecontainer"; The specified for the parameter "ContainerUriString" is invalid.

Update: my problem was due to a storage container owned by another subscription that was clearly not working. I made sure that the container belongs to the same subscription, and voila!

Refresh . This code assumes the following app.config file:

 <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> </startup> <system.serviceModel> <bindings> <webHttpBinding> <binding name="WindowsAzureServiceManagement_WebHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"> <readerQuotas maxStringContentLength="1048576" maxBytesPerRead="131072"/> <security mode="Transport"> <transport clientCredentialType="Certificate"/> </security> </binding> </webHttpBinding> </bindings> <client> <endpoint name="WindowsAzureEndPoint" address="https://management.core.windows.net" binding="webHttpBinding" bindingConfiguration="WindowsAzureServiceManagement_WebHttpBinding" contract="Microsoft.Samples.WindowsAzure.ServiceManagement.IServiceManagement" /> </client> </system.serviceModel> </configuration> 

or, alternatively, for LinqPad users, you can configure the embedded web service as follows:

  var b = new WebHttpBinding(WebHttpSecurityMode.Transport); b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; var address = new EndpointAddress("https://management.core.windows.net"); var managementService = ServiceManagementHelper.CreateServiceManagementChannel(b, address.Uri, certificate); 

Typical Usage:

 X509Certificate2 certificate = GetCertificate("My", "NNNNNNNNNNNNN"); ExportPackage(certificate, "00000000-0000-0000-0000-000000000000", "yourservice", "00000000000000000000000000000000", "https://yourstorage.blob.core.windows.net/container"); 
+2
source

All Articles