|
1 | | -# Azure CLI datashare Extension # |
2 | | -This package is for the 'datashare' extension, i.e. 'az datashare'. More info on what is [Data Share](https://docs.microsoft.com/azure/data-share/). |
3 | | - |
4 | | -### How to use ### |
5 | | -Install this extension using the below CLI command |
6 | | -``` |
7 | | -az extension add --name datashare |
8 | | -``` |
9 | | - |
10 | | -Register DataShare Resource Provider for your default susbcription. |
11 | | -``` |
12 | | -az provider register -n "Microsoft.DataShare" |
13 | | -``` |
14 | | - |
15 | | -### Included Features |
16 | | -#### Datashare Account Management |
17 | | -*Examples:* |
18 | | - |
19 | | -##### Create a Datashare Account |
20 | | - |
21 | | -``` |
22 | | -az datashare account create \ |
23 | | ---location "West US 2" \ |
24 | | ---tags tag1=Red tag2=White \ |
25 | | ---name "cli_test_account" \ |
26 | | ---resource-group "datashare_provider_rg" |
27 | | -``` |
28 | | - |
29 | | -##### Wait for the Datashare Account to be provisioned |
30 | | -``` |
31 | | -az datashare account wait \ |
32 | | ---name "cli_test_account" \ |
33 | | ---resource-group "datashare_provider_rg" \ |
34 | | ---created |
35 | | -``` |
36 | | - |
37 | | -#### Datashare Resource Management for a Provider |
38 | | -*Examples:* |
39 | | - |
40 | | -##### Create a Datashare |
41 | | -``` |
42 | | -az datashare create \ |
43 | | ---account-name "cli_test_account" \ |
44 | | ---resource-group "datashare_provider_rg" \ |
45 | | ---description "share description" \ |
46 | | ---share-kind "CopyBased" \ |
47 | | ---terms "Confidential" \ |
48 | | ---name "cli_test_share" |
49 | | -``` |
50 | | - |
51 | | -##### Create a Data Set |
52 | | -``` |
53 | | -az datashare dataset create \ |
54 | | ---account-name "cli_test_account" \ |
55 | | ---name "cli_test_data_set" \ |
56 | | ---resource-group "datashare_provider_rg" \ |
57 | | ---share-name "cli_test_share" \ |
58 | | ---dataset "{\"container_name\":\"mycontainer\",\"storage_account_name\":\"mysa\",\"kind\":\"Container\"}" |
59 | | -``` |
60 | | - |
61 | | -Please make sure the datashare account has the right permission of the data source when creating a data set upon it. |
62 | | -For instance, you can use `az datashare account show` to get 'identity.principalId' of the account, then assign the right role to it. |
63 | | -``` |
64 | | -az role assignment create \ |
65 | | ---role "Storage Blob Data Reader" \ |
66 | | ---assignee-object-id {DatashareAccountPrincipalId} \ |
67 | | ---assignee-principal-type ServicePrincipal \ |
68 | | ---scope {StorageAccountId} |
69 | | -``` |
70 | | - |
71 | | -##### Create a Synchronization Setting |
72 | | -``` |
73 | | -az datashare synchronization-setting create \ |
74 | | ---account-name cli_test_account \ |
75 | | ---resource-group datashare_provider_rg \ |
76 | | ---share-name cli_test_share \ |
77 | | ---name cli_test_synchronization_setting \ |
78 | | ---recurrence-interval Day \ |
79 | | ---synchronization-time "2020-04-05 10:50:00 +00:00" \ |
80 | | ---kind ScheduleBased |
81 | | -``` |
82 | | - |
83 | | -##### List Synchronization History |
84 | | -``` |
85 | | -az datashare synchronization list \ |
86 | | ---account-name "cli_test_account" \ |
87 | | ---resource-group "datashare_provider_rg" \ |
88 | | ---share-name "cli_test_share" |
89 | | -``` |
90 | | - |
91 | | -##### Create a Datashare Invitation |
92 | | -``` |
93 | | -az datashare invitation create \ |
94 | | ---account-name "cli_test_account" \ |
95 | | ---target-email "[email protected]" \ |
96 | | ---name "cli_test_invitation" \ |
97 | | ---resource-group "datashare_provider_rg" \ |
98 | | ---share-name "cli_test_share" |
99 | | -``` |
100 | | - |
101 | | -##### List Share Subscriptions |
102 | | -``` |
103 | | -az datashare provider-share-subscription list \ |
104 | | ---account-name "cli_test_account" \ |
105 | | ---resource-group "datashare_provider_rg" \ |
106 | | ---share-name "cli_test_share" |
107 | | -``` |
108 | | -Share subscriptions are created by Datashare consumers when they accept invitations. |
109 | | - |
110 | | -##### Revoke Datashare for a Share Subscription |
111 | | -``` |
112 | | -az datashare provider-share-subscription revoke \ |
113 | | ---account-name "cli_test_account" \ |
114 | | ---share-subscription "{ProviderShareSubscriptionObjectId}" \ |
115 | | ---resource-group "datashare_provider_rg" \ |
116 | | ---share-name "cli_test_share" |
117 | | -``` |
118 | | - |
119 | | -##### Reinstate Datashare for a Share Subscription |
120 | | -``` |
121 | | -az datashare provider-share-subscription reinstate \ |
122 | | ---account-name "cli_test_account" \ |
123 | | ---share-subscription "{ProviderShareSubscriptionObjectId}" \ |
124 | | ---resource-group "datashare_provider_rg" \ |
125 | | ---share-name "cli_test_share" |
126 | | -``` |
127 | | - |
128 | | -#### Datashare Resource Management for a Consumer |
129 | | -*Examples:* |
130 | | - |
131 | | -##### List received Invitations |
132 | | -``` |
133 | | -az datashare consumer invitation list |
134 | | -``` |
135 | | - |
136 | | -##### Create a Share Subscription from an Invitation |
137 | | -``` |
138 | | -az datashare consumer share-subscription create \ |
139 | | ---account-name "cli_test_consumer_account" \ |
140 | | ---resource-group "datashare_consumer_rg" \ |
141 | | ---invitation-id "{InvitationId1}" \ |
142 | | ---source-share-location "sourceShareLocation" \ |
143 | | ---name "cli_test_share_subscription" |
144 | | -``` |
145 | | - |
146 | | -##### List Source Data Sets in the Share Subscription |
147 | | -``` |
148 | | -az datashare consumer share-subscription list-source-dataset \ |
149 | | ---account-name "cli_test_consumer_account" \ |
150 | | ---resource-group "datashare_consumer_rg" \ |
151 | | ---share-subscription-name "cli_test_share_subscription" |
152 | | -``` |
153 | | - |
154 | | -##### Create a Data Set Mapping of the Source Data Set |
155 | | -``` |
156 | | -az datashare consumer dataset-mapping create \ |
157 | | ---account-name "cli_test_consumer_account" \ |
158 | | ---name "cli_test_data_set_mapping" \ |
159 | | ---resource-group "datashare_consumer_rg" \ |
160 | | ---share-subscription-name "cli_test_share_subscription" \ |
161 | | ---mapping "{\"data_set_id\":\"2036a39f-add6-4347-9c82-a424dfaf4e8d\", \ |
162 | | -\"container_name\":\"newcontainer\", \"storage_account_name\":\"consumersa\", \ |
163 | | -\"kind\":\"BlobFolder\",\"prefix\":\"myprefix\"}" |
164 | | -``` |
165 | | -Please make sure the datashare consumer account has the right permission of the data target when creating a data set mapping on it. For instance, you can use `az datashare account show` to get 'identity.principalId' of the account, then assign the right role to it. |
166 | | -``` |
167 | | -az role assignment create \ |
168 | | ---role "Storage Blob Data Contributor" \ |
169 | | ---assignee-object-id "{ConsumerDatashareAccountPrincipalId}" \ |
170 | | ---assignee-principal-type ServicePrincipal \ |
171 | | ---scope "{ConsumerStorageAccountId}" |
172 | | -``` |
173 | | - |
174 | | -##### List the synchronization settings of the Source Datashare |
175 | | -``` |
176 | | -az datashare consumer share-subscription list-source-share-synchronization-setting \ |
177 | | ---account-name "cli_test_consumer_account" \ |
178 | | ---resource-group "datashare_consumer_rg" \ |
179 | | ---share-subscription-name "cli_test_share_subscription" |
180 | | -``` |
181 | | - |
182 | | -##### Create a trigger for the Share Subsciption |
183 | | -``` |
184 | | -az datashare consumer trigger create \ |
185 | | ---account-name "cli_test_consumer_account" \ |
186 | | ---resource-group "datashare_consumer_rg" \ |
187 | | ---share-subscription-name "cli_test_share_subscription" \ |
188 | | ---name "cli_test_trigger" \ |
189 | | ---recurrence-interval Day \ |
190 | | ---synchronization-time "2020-04-05 10:50:00 +00:00" \ |
191 | | ---kind ScheduleBased |
192 | | -``` |
193 | | - |
194 | | -##### Start a synchronization for the Share Subscription |
195 | | -``` |
196 | | -az datashare consumer share-subscription synchronization start \ |
197 | | ---account-name "cli_test_consumer_account" \ |
198 | | ---resource-group "datashare_consumer_rg" \ |
199 | | ---share-subscription-name "cli_test_share_subscription" \ |
200 | | ---synchronization-mode "Incremental" |
201 | | -``` |
| 1 | +Microsoft Azure CLI 'datashare' Extension |
| 2 | +========================================== |
| 3 | + |
| 4 | +This package is for the 'datashare' extension. |
| 5 | +i.e. 'az datashare' |
0 commit comments