reffec.com

Using the Windows Azure Platform PowerShell cmdlets in .NET Drawer UPC Symbol in .NET Using the Windows Azure Platform PowerShell cmdlets Code39 for .NET

7. using none tocreate none in asp.net web,windows applicationbusinessrefinery.com code 39 .net In step 13, we add none for none the ServiceManagementOperation utility class that we use to invoke operations against the Service Management API. In steps 14 and 15, we define some configuration settings in the service definition file and specify them in the service configuration file. We provide values for the Windows Azure Storage Service account name and access key.

We also provide the subscription ID for the Windows Azure subscription, as well as the service name for current hosted service. We also need to add the thumbprint for the X.509 certificate we uploaded as a management certificate to the Windows Azure subscription and a service certificate to the hosted service we are deploying this application into.

Note that this thumbprint is the same as that configured in the Certificate section of the ServiceConfiguration.cscfg file. This duplication is necessary because the Certificate section of this file is not accessible to the application code.

. Visual Studio Development Tools and Languages Using the Windows Azure Platform PowerShell cmdlets The Windows Azure P none none latform PowerShell cmdlets use the Windows Azure Service Management REST API to expose service management operations as PowerShell cmdlets. The cmdlets provide a convenient way to manage hosted services, including retrieving the properties of current deployments and uploading new and upgraded deployments. In this recipe, we will learn how to use the Windows Azure Platform PowerShell cmdlets to invoke various service operations in the Windows Azure Service Management REST API.

. Getting ready If necessary, we ca none for none n download PowerShell 2 from the Microsoft download center at the following URL:. http://www.microsoft.com/download/en/details.aspx id=11829 We need to download none for none and install the Windows Azure Platform PowerShell cmdlets. The package with the cmdlets can be downloaded from the following URL:. http://wappowershel l.codeplex.com/.

Once the package ha none for none s been downloaded, the cmdlets need to be built and installed. The installed package contains a StartHere file explaining the process..

Managing Hosted Services with the Service Management API How to do it... We are going to use the Windows Azure Platform cmdlets to retrieve various properties of a Windows Azure subscription and a hosted service in it. 1. Create a PowerShell script named Get-Properties.

ps1 and insert the following text:. $subscriptionId = " none for none SUBSCRIPTION_ID" $serviceName = "SERVICE_NAME" $thumbprint = "THUMBPRINT" $getCertificate = Get-Item cert:\LocalMachine\My\$thumbprint Add-PSSnapin AzureManagementToolsSnapIn Get-HostedServices -SubscriptionId $subscriptionId -Certificate $getCertificate Get-AffinityGroups -SubscriptionId $subscriptionId -Certificate $getCertificate Get-HostedProperties -SubscriptionId $subscriptionId -Certificate $getCertificate -ServiceName $serviceName. 2. Launch PowerShel l. 3.

Navigate to the directory containing Get-Properties.ps1. 4.

Invoke the cmdlets to retrieve the properties:. .\Get-Properties.ps1 How it works... In step 1, we creat none none e the PowerShell script to invoke the get hosted service properties, list affinity groups, and get hosted service properties operations in the Windows Azure Service Management REST API. We need to provide the subscription ID for the Windows Azure subscription, the name of the hosted service, and the thumbprint for a management certificate uploaded to the Windows Azure subscription. In the script, we retrieve the X.

509 certificate from the Personal (My) certificate store on the local machine level. If necessary, we can specify the current user level, instead of the local machine level, by using CurrentUser in place of LocalMachine when we define $getCertificate. In steps 2 and 3, we set up PowerShell.

In step 4, we invoke the script using a .\ syntax to demonstrate that we really want to invoke an unsigned script in the current directory..

7 . There"s more... PowerShell supports an execution policy to restrict the PowerShell scripts that can be run on a system. If the current execution policy does not permit the Windows Azure Service Management cmdlets to run, then the execution policy can be changed to remote signed by invoking the following at the command prompt:. C:\Users\Administra none for none tor>PowerShell -command "Set-ExecutionPolicy RemoteSigned". This sets the globa l PowerShell execution context. PowerShell 2 introduced a command-line switch allowing it to be set only for the current invocation:. C:\Users\Administrator>PowerShell -ExecutionPolicy RemoteSigned Azure Management cmdlets Cerebrata has relea none for none sed a commercial set of Azure Management cmdlets that are more extensive than the Windows Azure Service Management cmdlets. The following PowerShell script retrieves the list of affinity groups for a Windows Azure subscription, including the GUID identifier not available on the Windows Azure Portal:. $subscriptionId = " SUBSCRIPTION_ID" $thumbprint = "THUMBPRINT" $getCertificate = Get-ChildItem -path cert:\LocalMachine\My\$thumbprint Add-PSSnapin AzureManagementCmdletsSnapIn Get-AffinityGroup -SubscriptionId $subscriptionId -Certificate $getCertificate. We need to provide none none the subscription ID for the Windows Azure subscription, and the thumbprint for a management certificate uploaded to the Windows Azure subscription. In the script, we retrieve the X.509 certificate from the Personal (My) certificate store on the local machine level.

If necessary, we can specify the current user level, instead of the local machine lever, by using CurrentUser in place of LocalMachine when we define $getCertificate. We can use the following command to retrieve the list of Windows Azure locations:.
Copyright © reffec.com . All rights reserved.