Skip to content

Conversation

@nathannfan
Copy link
Contributor

@nathannfan nathannfan commented Mar 17, 2017

az sql db import -h
Command
    az sql db import: Imports a bacpac into an existing database.

Arguments
    --admin-password -p [Required]: The password of the SQL administrator.
    --admin-user -u     [Required]: The name of the SQL administrator.
    --name -n           [Required]: Name of the Azure SQL Database.
    --resource-group -g [Required]: Name of resource group. You can configure the default group
                                    using 'az configure --defaults group=<name>'.
    --server -s         [Required]: Name of the Azure SQL server.
    --storage-key       [Required]: The storage key to use.
    --storage-key-type  [Required]: The type of the storage key to use. Valid values are
                                    StorageAccessKey and SharedAccessKey.  Allowed values:
                                    SharedAccessKey, StorageAccessKey.
    --storage-uri       [Required]: The storage uri to use.
    --auth_type                   : The authentication type - if not specified, will default to SQL.
                                    Allowed values: ADPassword, SQL.
    --type                        : The type of the extension.
az sql db export -h
Command
    az sql db export: Exports a database to a bacpac.

Arguments
    --admin-password -p [Required]: The password of the SQL administrator.
    --admin-user -u     [Required]: The name of the SQL administrator.
    --name -n           [Required]: Name of the Azure SQL Database.
    --resource-group -g [Required]: Name of resource group. You can configure the default group
                                    using 'az configure --defaults group=<name>'.
    --server -s         [Required]: Name of the Azure SQL server.
    --storage-key       [Required]: The storage key to use.
    --storage-key-type  [Required]: The type of the storage key to use. Valid values are
                                    StorageAccessKey and SharedAccessKey.  Allowed values:
                                    SharedAccessKey, StorageAccessKey.
    --storage-uri       [Required]: The storage uri to use.
    --auth_type                   : The authentication type - if not specified, will default to SQL.
                                    Allowed values: ADPassword, SQL.

@msftclas
Copy link

@nathannfan,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@jaredmoo
Copy link
Contributor

jaredmoo commented Mar 17, 2017

How does SharedAccessKey work? Do you put the SAS value in as the --storage-key? What happens if you put the SAS key on the end of the file uri instead?

azure-cli.pyproj Outdated
<Folder Include="command_modules\azure-cli-component\azure-cli-configure\azure\" />
<Folder Include="command_modules\azure-cli-component\azure-cli-configure\azure\cli\" />
<Folder Include="command_modules\azure-cli-component\azure-cli-configure\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-component\azure-cli-configure\azure\cli\command_modules\configure\" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did these changes happen? Maybe these should be reverted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, must have happened during a merge.

@codecov-io
Copy link

codecov-io commented Mar 17, 2017

Codecov Report

Merging #2538 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2538      +/-   ##
==========================================
+ Coverage    72.1%   72.13%   +0.03%     
==========================================
  Files         362      362              
  Lines       19791    19813      +22     
  Branches     2920     2920              
==========================================
+ Hits        14270    14292      +22     
+ Misses       4604     4600       -4     
- Partials      917      921       +4
Impacted Files Coverage Δ
...re-cli-sql/azure/cli/command_modules/sql/params.py 96.91% <100%> (+0.41%)
...-cli-sql/azure/cli/command_modules/sql/commands.py 100% <100%> (ø)
...zure-cli-sql/azure/cli/command_modules/sql/help.py 100% <100%> (ø)
src/azure-cli-core/azure/cli/core/_util.py 66.66% <0%> (ø)
...dback/azure/cli/command_modules/feedback/custom.py 34.69% <0%> (ø)
...-cli-role/azure/cli/command_modules/role/custom.py 17.89% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9c09d2...d65edeb. Read the comment docs.

@jaredmoo
Copy link
Contributor

--type param shouldn't be there, right?

@jaredmoo
Copy link
Contributor

Can you make a swagger change to deweirdify this message? You can remove Valid values are StorageAccessKey and SharedAccessKey. from the spec.

    --storage-key-type  [Required]: The type of the storage key to use. Valid values are
                                    StorageAccessKey and SharedAccessKey.  Allowed values:
                                    SharedAccessKey, StorageAccessKey.

'ServersOperations')

with ServiceGroup(__name__, get_sql_servers_operation, server_operations) as s:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking: this is not required.

' --storage-key {} --storage-key-type StorageAccessKey'
' --storage-uri {}{}/testbacpac.bacpac'
.format(server, db_name2, rg, admin_password, admin_login, key,
storage_endpoint, container))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There aren't any assertion on the last two command execution except the exit code. Shall we add more assertions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


loc_long = location_long_name
rg = resource_group
sa = storage_account
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these assignment just for the sake of a shorter name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None blocking, but not recommended. Longer variable names improve the readability. Reassign and shorten the names defeat the purpose.

admin_password = 'SecretPassword123'
db_name = 'cliautomationdb01'
db_name2 = 'cliautomationdb02'
container = 'bacpacs'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the self.create_random_name for all these names?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is random preferred? Db names only need to be unique within a server.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, it should be fine.


firewall_rule_1 = 'allowAllIps'
start_ip_address_1 = '0.0.0.0'
end_ip_address_1 = '255.255.255.255'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work if you just allow azure ips? i.e. start_ip_address = 0.0.0.0, end_up_address = 0.0.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does

@jaredmoo
Copy link
Contributor

Looks great overall, just curious how SAS keys work. Could you add examples for each key type to help doc? Take a look at my help.py changes in #2536 to see how to format examples.

Test for SAS key would be nice to have but not required.

@troydai troydai merged commit 5ce8235 into Azure:master Mar 19, 2017
@nathannfan
Copy link
Contributor Author

@troydai Thanks!

thegalah pushed a commit to thegalah/azure-cli that referenced this pull request Mar 21, 2017
* Azure/master: (478 commits)
  vm live test: allow more valid power states on vmss test verifications (Azure#2564)
  rbac:catch more graph error (Azure#2567)
  appservice: support to create plan when create a webapp (Azure#2550)
  Update storage tests (Azure#2556)
  Change PEP8 check filter from whitelist to blacklist (Azure#2557)
  Add scenario tests documentation (Azure#2555)
  [ACS] Adding support for configuring a default ACS cluster (Azure#2554)
  [ACS] Provide a short name alias for the orchestrator type flag (Azure#2553)
  Sql Import/Export CLI commands and test (Azure#2538)
  Fix format bug. (Azure#2549)
  [VM/VMSS] Improved disk caching support (Azure#2522)
  VM/VMSS: incorporate credentials validation logic used by portal (Azure#2537)
  Script that creates packaged releases package archive (Azure#2508)
  Adding alias for defaults flag (Azure#2540)
  Add wait commands and --no-wait support (Azure#2524)
  choice list outside of named arguments (Azure#2521)
  Fixed test failure in test_sql_db_mgmt. (Azure#2530)
  core: support login using service principal with a cert (Azure#2457)
  Add note about being in preview (Azure#2512)
  vm:fix distro check mechanism used by disk encryption (Azure#2511)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants