Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az group export: query/output parameters not supported #5777

Closed
dtissen opened this issue Mar 12, 2018 · 7 comments
Closed

az group export: query/output parameters not supported #5777

dtissen opened this issue Mar 12, 2018 · 7 comments
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Resource Manager
Milestone

Comments

@dtissen
Copy link

dtissen commented Mar 12, 2018

  1. The az group export command fails allways if the resource group has unknown schema types.

For Example: The schema of resource type 'Microsoft.Network/virtualNetworkGateways' is not available.
If i try to export a Template I will allways get this message. But instead of giving me the template without the unknown schema i get nothing. The Problem is: there a many unknown schemas 👎

The Problem get even worese because the query parameter does not work either!

  1. Query Parameter does not work. For example [?type=='Microsoft.Storage/storageAccounts']" --> give me a Template for the storageAccounts. Does not work.

Since the azure portal is able to show me a deployment template the REST seems to be able deliver just a part of the resource group --> The issue must be the azure-cli.


Environment summary

Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

@tjprescott
Copy link
Member

tjprescott commented Mar 12, 2018

Please update your CLI. This issue was addressed in azure-cli-resource 2.0.24. If you still experience this issue, please reopen.

@dtissen
Copy link
Author

dtissen commented Mar 13, 2018

The Issue is still present:

azure-cli (2.0.27)

acr (2.0.21)
acs (2.0.26)
advisor (0.1.2)
appservice (0.1.26)
backup (1.0.6)
batch (3.1.10)
batchai (0.1.5)
billing (0.1.7)
cdn (0.0.13)
cloud (2.0.12)
cognitiveservices (0.1.10)
command-modules-nspkg (2.0.1)
configure (2.0.14)
consumption (0.2.1)
container (0.1.18)
core (2.0.27)
cosmosdb (0.1.19)
dla (0.0.18)
dls (0.0.19)
eventgrid (0.1.10)
extension (0.0.9)
feedback (2.1.0)
find (0.2.8)
interactive (0.3.16)
iot (0.1.17)
keyvault (2.0.18)
lab (0.0.17)
monitor (0.1.2)
network (2.0.23)
nspkg (3.0.1)
profile (2.0.19)
rdbms (0.0.12)
redis (0.2.11)
reservations (0.1.1)
resource (2.0.23)
role (2.0.19)
servicefabric (0.0.10)
sql (2.0.21)
storage (2.0.25)
vm (2.0.26)

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.1 (default, Feb 9 2018, 03:55:42)
[GCC 4.7.2]

Legal docs and information: aka.ms/AzureCliLegal

root@DavidTissen-PC:~# az group export -g int02
The schema of resource type 'Microsoft.Network/virtualNetworkGateways' is not available. Resources of this type will not be exported to the template.

@tjprescott
Copy link
Member

tjprescott commented Mar 13, 2018

The Issue is still present:
azure-cli (2.0.27)
resource (2.0.23)

The issue was fixed in version 2.0.24 of the resource module, not the CLI overall. It would likely be version 2.0.28 or higher of the CLI.

I just verified it on a resource group with a VNET gateway.

@tjprescott tjprescott changed the title az group export: not usable in some cases Group export: query parameter does not work Mar 13, 2018
@tjprescott tjprescott changed the title Group export: query parameter does not work az group export: query parameter not supported Mar 13, 2018
@tjprescott tjprescott reopened this Mar 13, 2018
@tjprescott tjprescott added this to the Backlog milestone Mar 13, 2018
@tjprescott tjprescott changed the title az group export: query parameter not supported az group export: query/output parameters not supported Mar 13, 2018
@tjprescott
Copy link
Member

You are correct in that the query parameter is not supported--nor is output format. However, the behavior of query (if it were applied) would not return you a template for a storage account. The query would need to look like:
--query resources[?type=='Microsoft.Storage/storageAccounts']

It would return you the resource content for storage accounts, which would not be a usable template by itself. Query is basically client-side filtering of the output object.

Are you wanting to just export a single resource/type from your resource group?

@dtissen
Copy link
Author

dtissen commented Mar 14, 2018

Actually my issue is related to the fact that a lease for premium storage cannot be broken. My current approach to snapshot VM's is to snapshot the related blobs. To promote a Snapshot i delete the VM and after promoting the Snapshots i create the VM again. The best approach i found therefor is to export the vm configuration (and all other resources) and then deploy only the VM again - yes I have to delete many things from the exported template. But it seems for me the most secure way to recreate a VM as it was before..... Any better idea? I know i could attach another blob (e.g. snapshoted blob copy as new blob) but in that case i would lose my other snapshots for the blob and the process would be even worse.

You are right with the query, shame on me. I just saw the last itemes which were a list, forgot that they are part of resources an there are also parameter and so on...

@tjprescott
Copy link
Member

Your approach sounds reasonable. Were you able to export the exportable resources with the latest CLI version?

@dtissen
Copy link
Author

dtissen commented Mar 14, 2018

Yes tried out right now - works! Thank you very much. Issue can be closed.

@dtissen dtissen closed this as completed Mar 14, 2018
@mozehgir mozehgir added the ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group label Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Resource Manager
Projects
None yet
Development

No branches or pull requests

4 participants