Database scaling scrip in Azure automation .

Hi ,
we have one SQL server in Azure that host some database , I wrote a script for scaling up and scaling down databases on the SQls erver ,
$Database = "mydatabase"
$SQLserver = "mysqlserver"
Select-AzureSubscription -Id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$db = Get-AzureSqlDatabase $SQLserver -DatabaseName $Database
$P1 = Get-AzureSqlDatabaseServiceObjective $SQLserver -ServiceObjectiveName "S1"
Set-AzureSqlDatabase $SQLserver -Database $db -ServiceObjective $P1 -Edition Standard -Force
now I want to use that script in Azure Automation ,
I want to run that script to scale down the database in night hours and scale up in day hours .
please , I need some guide or help on how can import that script to Azure automation to auto scale my database .
Thanks alot 

Hi Ary,
Please also see the following workflow:
Vertically Scale.
For this runbook to execute successfully, the Azure DB logical server must allow incoming connections from Azure services. This configuration can be achieved in the Microsoft Azure portal by selecting the server, clicking on the "Configure" tab
and, under allowed services, selecting 'YES' for Windows Azure Services. 
As prerequisite, please create an Azure Automation credential asset that contains the username and password for the target Azure SQL DB logical server ($SqlServerName).
To import the script referenced above, go to one of your Azure Automation accounts, click "New" and then "Runbook".  Next click "From Gallery", and in the "Select a runbook" select "Capacity Management"
and then "Azure SQL Database: Vertically Scale".
If you want to use the script you mentioned above, you can copy and paste the script wrapped in a workflow{} into a new runbook.  If you're going to use the Set-AzureSqlDatabase PowerShell cmdlets, you're also going to need to update a certificate to
Azure Automation.  One way around this is to perform the scaling actions via tsql.
If you have any questions, I'd be happy to help.

Similar Messages

  • How to Install Azure SDK on Azure automation

    i have a powershell script that connect to storage table and read the data from a Table.  which works fine on the local where Azure SDK 2.1 is installed.
    While i add it as part of Azure automation i get an error as not able to resolve "Microsoft.WindowsAzure" this is because we donot have Azure SDK on the machine where this
    runbook of azure automation is running.
    IS there any option to enable/install  Azure SDK on the machine where runbook executes?
    Is there any alternate option to upload required assemblies as part of setting so that runbook could use while executing. 
    below is the sample power shell script to connect to storage table.
    [string]$storageAccountName ='xxxxx'
    [string]$storageAccountKey =’xxxxxxx'
    $accountCredentials = New-Object Microsoft.WindowsAzure.Storage.Auth.StorageCredentials $storageAccountName, #Create instance of CloudStorageAccount object
    $storageAccount = New-Object "Microsoft.WindowsAzure.Storage.CloudStorageAccount" $accountCredentials, $true
    #Create table client
    $tableClient = $storageAccount.CreateCloudTableClient()

    This is not a scripting question.  You need to ask this in the Azure forum.
    Jut adding a bit of script to your question does not make it a script issue.  Yu need to as the Azure techs how to install and manage the Azure platform.  They will give you links to the docs you need to learn how to deploy Azure.
    The SDK can be downloaded from Microsoft.
    ¯\_(ツ)_/¯

  • Oracle Database Partitioning Feature on Azure VM

    Hi,
    we would like to know if Oracle Database partitioning feature is available and activable on Azure virtual machine with Oracle pre-installed database instance.
    Thanks

    Hi,
    Oracle Database 11g R2 EE with Advanced Options includes Partitioning.
    Create a virtual machine from here:, check this link:
    http://azure.microsoft.com/en-in/marketplace/partners/msopentech/oracle-db-11g-db-11g-ee-all/
    Regards,
    Azam khan

  • On-premise database connect to windows azure

    How to connect on-premise sql db from azure

    have you looked at setting up VPN between Azure and on-premise?
    or you can write a service on-premise that connects to your database and use Service Bus Relay

  • Issue in Migrating Sql Server Database 2012 to Sql Azure

    Hi All
    I am facing following issue while Deployed MS SQL Server 2012 Database to SQL Azure.
    TITLE: Microsoft SQL Server Management Studio
    One or more unsupported elements were found in the schema used as part of a data package.
    Error SQL71564: The element Extended Property: [dbo].[Accounts_Login].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
    Error SQL71564: The element Extended Property: [dbo].[Company_Master].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
    Error SQL71564: The element Extended Property: [dbo].[Message_Master].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
    Error SQL71564: The element Extended Property: [dbo].[Requests_Master].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
    Error SQL71564: The element Extended Property: [dbo].[Twitter_Master].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
    Error SQL71564: The element Extended Property: [dbo].[Users_Master].[MS_SSMA_SOURCE] is not supported when used as part of a data package (bacpac).
     (Microsoft.SqlServer.Dac)
     Error SQL71564: The element Extended Property: xxx is not supported when used as part of a data package (bacpac).
    Thanks & Regards Ravi Shankar

    Hello,
    Extended Properties are not supported in SQL Azure.
    To work around this issue, you can use Generate Scripts Wizard to generate script which are compatible with SQL Database and can be compiled on SQL Database without any further modifications. For example, in Choose Script Options, click on the Advanced button
    and, set Script Extended Properties = False.
    Reference:http://social.technet.microsoft.com/wiki/contents/articles/994.develop-and-deploy-with-windows-azure-sql-database.aspx
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Azure Automation Runbooks Unexpectantly Repeating

    We currently have runbooks that run every 5 minutes, every hour on the hour, and every day.  These scripts query an Azure DB, provision VMs, start/stop VMs, etc.  They have ran great for months.  Beginning Wednesday 4/15, we started noticing
    weird behaviour where the script would start, hang, then start again.  This unexpected behavior has made our scripts useless and we've been unable to utulize our solution for 3 days.  There are over 20 jobs that were stuck in "starting",
    some that were suspended, and some that I was able to force to stop.  Has anyone else noticed this issue in the recent days?  I've been working with Support for 2 days but haven't seen any improvement or gotten any answers.
    Thanks,
    Chris

    Chris can you have the support person you have been working with email me your subscription id, automation account name, the name of the runbook having issues, and when your latest problematic job for this runbook started?
    The only reason I recommend going through the support person is so that you don't have to post that information publicly here. If that does not matter to you, you can leave that info here instead.

  • Automated export appearing on database list

    Hello,
    I have an Azure SQL Database (Web edition) with an automated export set for daily exports.
    Sometimes (like today for instance) when I log into Azure management portal, I see an additional database listed with the name of my export.
    As far as I know, an export should not be listed as a new available database, right?
    Why this is happening and how can I fix that?
    Thank you,
    Igor
    .NET Software developer for industrial internet and automation system.

    Hello Igor, 
    Thank you for asking this question.
    The Automated Export service creates a database copy of the database you are exporting. It then will perform the export operation on the copy of the database. This is done to guarantee transaction consistency during the export. After the export has completed
    the database copy will be deleted. 
    You can learn more about Import/Export and Automated Export here https://msdn.microsoft.com/en-us/library/azure/hh335292.aspx
    Additionally if you are interested in our Basic, Standard, or Premium service tiers, they come with built-in restore capabilities.
    You can learn more about these capabilities and other business continuity capabilities here https://msdn.microsoft.com/en-us/library/azure/hh852669.aspx
    If you would like to share more about your scenario or discuss Azure SQL Database's backup and restore capabilities in further detail please email me at Elfish at Microsoft dot com.
    Thanks and I hope this helps,
    -Eli

  • Troubles Exporting SQL databases from Azure

    1. If I connect via SQL Server Management Studio and choose Export Data Tier Application to local disk, it never ends
    2. If I export via Azure web portal, it takes few hours
    3. The only way that works is using  SQL Server Management Studio and exporting to Azure container and then downloading it and importing via SQL Server Management Studio, seems like a lot of hassle
    I need Azure SQL database to be transferred daily to my local machine, preferably automatically. How can I do it?

    Hi Alex,
    Since the issue regards Windows Azure SQL Database, I will help you move the question to the related forums, It is appropriate and more experts will assist you.
    As Olaf’s post, if you want to migrate databases between the SQL Server Database Engine and Windows Azure SQL Database, you can use the Windows Azure SQL Database Import and Export operations to copy databases between two different SQL Database servers.
     In addition, you can also use the Windows Azure SQL Database copy database feature to make a consistent copy of a database, and perform the export from the copy. For more information, see
    Copying Databases in Windows Azure SQL Database. And you also can migrate a database by using the generate scripts wizard. For more information, see:
    How to: Migrate a Database by Using the Generate Scripts Wizard (Windows Azure SQL Database)
    According to your description, you want to migrate database daily and automatically, you can configure automated exports to schedule export operations for a SQL database, and to specify the frequency of export operations, and to set the retention period
    to store export files. Also you can set data sync between SQL Server and Windows Azure SQL database, configure bi-directional for database. For more information, see:
    Windows Azure SQL Data Sync.
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Can No Longer Connect to Azure SQL Databases

    As of this morning, I am no longer to connect to any of my Azure SQL databases by any (apparent) means. I checked the configuration in the azure portal and my IP address is listed as an allowed IP, however:
    I am unable to connect via SQL Server Management Studio
    My request times out when attempting to visit https://{server_name}.database.windows.net
    What might have caused this?

    Hi ,
    Thanks for posting here.
    To resolve the issue you can try the following steps (in that order):
                    Check the application’s connection string to make sure that it is correctly configured. For example, make sure that the connection string specifies the correct port
    (1433) and the fully qualified server name.                
    Note You can follow these steps to obtain the connection string from the Azure Management Portal:                  
                          Log on to the
    Azure Management Portal.                    
                          In the left navigation pane, click
    SQL Databases.                    
                          Select your Azure SQL Database server.                    
                          Click
    Dashboard.                    
                          On the right side, go to the
    quick glance section, and then click Show connection strings.                    
                    Make sure that TCP IP is enabled as a client protocol on the application server. For more information on how to do this, see
    Configure client protocols. On application servers where you do not have SQL Server tools installed, you can check this by running cliconfg.exe (SQL Server Client Network Utility).              
                    Test the connectivity between the application server and the Azure SQL database by using a UDL file, ping, and telnet. For more information about how to do this,
    see
    Azure SQL Database connectivity troubleshooting guide and
    Troubleshooting SQL Server connectivity issues.                
    Note As a troubleshooting step, you can also try to test the connectivity on a different client computer.                
                    Try increasing the connection
    timeout. Microsoft recommends using a connection timeout of at least 30 seconds.              
                    As a best practice ensure retry logic is in place. For more information about the retry logic, see
    Azure SQL Database best practices to prevent request denials or connection termination.              
                  If the previous steps do not resolve your problem, follow these steps to collect more data and contact support:              
                      If your application is a cloud service, enable the logging. This step returns a UTC time stamp of the failure. Additionally, SQL Azure returns the tracing
    ID.
    Microsoft Customer Support Services can use this information.                
                      For more information about how to enable the logging, see
    how to enable diagnostic logging for Azure Web sites and Developing SQL Database Applications section in
    Azure SQL Database Development Considerations.
    Please write back with the exact Error message/ Error Code if this doesn't help.
    Regards,
    Shirisha Paderu.

  • Cannot Connect to Azure SQL Database in Visual Studio 2013

    Beyond Frustrated here.
    I am trying to connect to an Azure SQL database - it has been created, has tables etc. I am trying to create a new Data Connection from within Visual Studio 2013, latest release for VS and Azure. I continue to receive the following error:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
    (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
    I have ensured that TCP is allowed and above Named Pipes in the Configuration Manager. The associated IP address is allowed on Azure Firewall. Certificate has been added to VS etc. But still no connection. I can see the database in the Azure section in Server
    Explorer, but cannot add a Data Connection. What is equally as frustrating is I have a MacBook Pro running Win 7 sitting right next to my office computer and it can access Azure fine, not problems.
    If anyone has any other ideas on how I might be able to solve this I would love to hear them. Thanks in advance.
    Jeff

    Hi,
     The Error message "   A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is
    configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53) "
    The issue comes up mainly because the application is not able to connect to the server.
    To resolve this issue, try the following steps (in that order):
     Make sure that TCP IP is enabled as a client protocol on the application server. For more information on how to do this, see
    Configure client protocols. On application servers where you do not have SQL Server tools installed, you can check this by running cliconfg.exe (SQL Server Client Network Utility).              
     2.  Check the application’s connection string to make sure that it is correctly configured. For example, make sure that the connection string specifies the correct port (1433) and the fully qualified server name.                
    Note You can follow these steps to obtain the connection string from the Azure Management Portal:                  
                          Log on to the
    Azure Management Portal.                    
                          In the left navigation pane, click
    SQL Databases.                    
                          Select your Azure SQL Database server.                    
                          Click
    Dashboard.                    
                          On the right side, go to the
    quick glance section, and then click Show connection strings.                    
    Test the connectivity between the application server and the Azure SQL database by using a UDL file, ping, and telnet. For more information about how to do this, see
    Azure SQL Database connectivity troubleshooting guide and
    Troubleshooting SQL Server connectivity issues.                
    Note As a troubleshooting step, you can also try to test the connectivity on a different client computer.                
    Try increasing the connection timeout. Microsoft recommends using a connection timeout of at least 30 seconds.              
    As a best practice ensure retry logic is in place. For more information about the retry logic, see
    Azure SQL Database best practices to prevent request denials or connection termination.              
          If these  steps do not resolve your problem, follow the below steps to collect more data and contact support:              
       If your application is a cloud service, enable the logging. This step returns a UTC time stamp of the failure. Additionally, SQL Azure returns the tracing ID.
    Microsoft Customer Support Services can use this information.                   
       For more information about how to enable the logging, see
    how to enable diagnostic logging for Azure Web sites and Developing SQL Database Applications section in
    Azure SQL Database Development Considerations.                
      Check out
    the list of best practices for Connecting to Windows Azure SQL Database.
    Regards,
    Shirisha Paderu.

  • Can't connect Azure Database in SQL Server

    Hi,
    I completed setting up the database and server on Azure, but when i tried to connect it using SQL Server 2012. I got an error.
    TITLE: Connect to Server
    Cannot connect to tcp:*******.database.windows.net,1433.
    ADDITIONAL INFORMATION:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=10061&LinkId=20476
    No connection could be made because the target machine actively refused it
    My IP was already added in Azure.
    I also checked that the TCP/IP was enabled on Configuration Manager.
    Any thoughts?
    Thanks!!

    Hi Aaron,
    If you are trying to manage your database through SSMS - make sure that the TCP/IP protocol is enabled.
    1) SQL server configuration manager
    2) In 'SQL server Network configuration'
    3) Enable TCP/IP
    Also try connecting your database through the web based sql azure management studio.
    http://msdn.microsoft.com/en-us/library/azure/ee336282.aspx
    http://social.technet.microsoft.com/wiki/contents/articles/2151.azure-and-sql-database-tutorials-tutorial-2-using-sql-database.aspx
    Girish Prajwal

  • Automation wrokspace not available in Azure

    I have an MSDN subscription and I cannot see the Automation workspace available in the portal. Any clues on how to get it to show up?
    Telmo Sampaio

    Hi,
    I suggest you have a look at below article, it may give you some help.
    #http://cloudcomputing.info/en/news/2014/04/microsoft-releases-preview-of-microsoft-azure-automation.html
    If you have a Microsoft Azure subscription you can activate the preview on the Preview Features page, please refer to the following blog that was written by Keith Mayer from Microsoft (http://blogs.technet.com/b/keithmayer/archive/2014/04/04/step-by-step-getting-started-with-windows-azure-automation.aspx).
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • New Azure Database does not have a manage button

    I just created new azure databases on a new Azure subscription. Everything appears to be in place except the Manage button is missing in the portal (both the old one and the new one). The manage button is displayed on the old subscription. I
    made sure my IP address is tied to the new server.
    Is there something else that needs done?

    Hi,
    Did you create a V12 Database?
    The manage button that links you to the Azure SQL Database Management Portal
    (http://yourservername.database.windows.net) is not supported by a V12 Azure SQL Databases.
    For more info, take a look at the Limitations section of this article:
    http://azure.microsoft.com/en-us/documentation/articles/sql-database-preview-plan-prepare-upgrade/
    Microsoft recommends Visual Studio 2013 Community Edition ( A Full Featured IDE - FREE! ).
    Download link here: https://www.visualstudio.com/products/visual-studio-community-vs
    In visual studio 2013, you'll have about the same capabilities as the old Azure SQL Database Management Portal.

  • VS2013 suddenly unable to read database schema on Azure server

    Hi,
    I have 2 databases on an azure server. Everything worked well until yesteday: VS2013 is now unable to read any database schema on this Azure server (same operations on an SQL EXPRESS instance are performed without problem).
    When I try to open any table definition, I have "the designer encountered an error while loading the table definition"
    When I try to rebuild after update the model (EF6) from database (I added a stored procedure), I have:
    "The target database schema could not be retrieved. Unable to reconnect to database: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. " (note that when I launched "update
    model from database", I had no problem. The fuss happens during the build).
    But I still can read data and execute procedure from Azure using VS 2013. I did not alter any credential. Using the same credentials, I still can create/update tables/procédures from Azure portal.
    I am a very basic user of VS2013 and Azure, I did not install or create anything weird on it.
    I emphisize same operations on an SQL EXPRESS instance are performed without problem.
    Thanks for help.
    Olivier

    Hello Olivier,
    Sorry for the inconvenience because of the above issue.
    Could you please try the new SSDT (preview) tool and check if you are able to get the table definition or not.
    http://blogs.msdn.com/b/ssdt/archive/2014/12/18/sql-server-database-tooling-preview-release-for-the-latest-azure-sql-database-update-v12-preview.aspx
    Download link : http://www.microsoft.com/en-us/download/details.aspx?id=45319
    Thanks,
    Mukesh

  • Error when trying to upgrade SQL Azure database using DAC Package in MGMT Studio - "Unexpected XML Content"

    Hi there,
    I am trying to upgrade a database running in SQL Azure from my local dev box which is running SQL Server 2008 R2 Sp1 (Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64))
    I extract the dac with no problems from my local database. However, when I try to upgrade the Azure db I get the below error.
    This error occurs just after I browse to select the dac package and click open in the browse window. I.e. It happens before I actually try and apply this dac to the Azure database. Something is going wrong, presumably, when the package is parsed by management
    studio.
    I am running Visual Studio 2010 Premium Sp1 if that matters, plus all the various updates required for Azure development..
    Thanks for your help!

    Hey there, and apologies for the lack of response.  Are you still having this issue and still needing help?
    Thanks Guy

Maybe you are looking for

  • Can't open Photoshop CC-says need to reinstall but won't reinstall

    I activated the free trial and used Photoshop- it was perfect. Now 2 days later, when I try to open the application, an error message comes saying that some application components are missing from the application directory and to please reinstall the

  • How do I get my macbook to sleep?

    I have a macbook pro 13" (late 2009) model with OSX Lion. I set the energy save preferences to go to sleep after 10 minutes when on battery power. But it doesn't go to sleep. The screen will go off, but the machine keeps running until the battery is

  • Lightroom - edit in Photoshop CS3 problem

    Hi All, I'm running Lightroom 2 on a MacPro. When I first installed it all was fine with 'edit in' function, which I had configured to PS CS3 my primary external editor. Later, as a test, I added an additional editor - Photomatix - just as a test mor

  • Infoset  error in BI7

    Hi all, Iam trying 2 load 2 incoubes in bi7 .but evary thing showing sucessfull .but when iam going to see display data . showing the error      Error reading the data of InfoProvider ISET_KK           Error when generating the SQL statement      POS

  • Please advise me on the best way to distort/warp/envelope this text

    Hi all, Please can you advise me on the most suitable way to distort/warp/envelope this text. I need to make it fit exactly (heightwise) into the white area below. I thought this would be a very simple thing to do in Illy but I was mistaken! I have t