1
1
# Azure Purview Share client library for .NET
2
2
3
- Microsoft Purview Share is a fully managed cloud service .
3
+ Microsoft Purview Data Sharing allows data to be shared in-place from Azure Data Lake Storage Gen2 and Azure Storage accounts, both within and across organizations .
4
4
5
- ** Please rely heavily on the [ service's documentation] [ share_product_documentation ] and our [ protocol client docs] [ protocol_client_quickstart ] to use this library**
5
+ Data providers may use Microsoft Purview Data Sharing to share their data directly with other users and partners (known as data consumers) without data duplication, while centrally managing their sharing activities from within Microsoft Purview.
6
+
7
+ For data consumers, Microsoft Purview Data Sharing provides near real-time access to data shared with them by a provider.
8
+
9
+ Key capabilities delivered by Microsoft Purview Data Sharing include:
10
+ - Share data within the organization or with partners and customers outside of the organization (within the same Azure tenant or across different Azure tenants).
11
+ - Share data from ADLS Gen2 or Blob storage in-place without data duplication.
12
+ - Share data with multiple recipients.
13
+ - Access shared data in near real time.
14
+ - Manage sharing relationships and keep track of who the data is shared with/from, for each ADLSGen2 or Blob Storage account.
15
+ - Terminate share access at any time.
16
+ - Flexible experience through Microsoft Purview governance portal or via REST APIs.
17
+
18
+ ** Please visit the following resources to learn more about this product.**
6
19
7
20
[ Source code] [ source_code ] | [ Package (NuGet)] [ client_nuget_package ] | [ Product documentation] [ share_product_documentation ]
8
21
@@ -28,19 +41,11 @@ This example demonstrates using [DefaultAzureCredential][default_cred_ref] to au
28
41
29
42
Once you have chosen and configured your credential, you can create instances of the ` SentSharesClient ` .
30
43
31
- ``` C# Snippet:SentSharesClientSample_CreateSentSharesClient
32
- var credential = new DefaultAzureCredential ();
33
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
34
- var sentShareClient = new SentSharesClient (endPoint , credential );
35
- ```
44
+ ## Key concepts
36
45
37
- ``` C# Snippet:ReceivedSharesClientSample_CreateReceivedSharesClient
38
- var credential = new DefaultAzureCredential ();
39
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
40
- var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
41
- ```
46
+ __ Data Provider:__ A data provider is the individual who creates a share by selecting a data source, choosing which files and folders to share, and who to share them with. Microsoft Purview then sends an invitation to each data consumer.
42
47
43
- ## Key concepts
48
+ __ Data Consumer: __ A data consumer is the individual who accepts the invitation by specifying a target storage account in their own Azure subscription that they'll use to access the shared data.
44
49
45
50
### Protocol Methods
46
51
@@ -62,15 +67,24 @@ We guarantee that all client instance methods are thread-safe and independent of
62
67
[ Client lifetime] ( https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/ )
63
68
<!-- CLIENT COMMON BAR -->
64
69
65
- ## Examples
70
+ ##Examples
71
+
72
+ ### Data Provider Examples
73
+
74
+ The following code examples demonstrate how data providers can use the Microsoft Azure Java SDK for Purview Sharing to manage their sharing activity.
66
75
67
- The following section shows you how to initialize and authenticate your client and share data.
76
+ #### Create a Sent Share Client
77
+ ``` C# Snippet:SentSharesClientSample_CreateSentSharesClient
78
+ var credential = new DefaultAzureCredential ();
79
+ var endPoint = new Uri (" https://my-account-name.purview.azure.com/share" );
80
+ var sentShareClient = new SentSharesClient (endPoint , credential );
81
+ ```
68
82
69
- ### Create a sent share
83
+ #### Create a Sent Share
70
84
71
85
``` C# Snippet:SentSharesClientSample_CreateSentShare
72
86
var credential = new DefaultAzureCredential ();
73
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
87
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
74
88
var sentShareClient = new SentSharesClient (endPoint , credential );
75
89
76
90
var data = new
@@ -107,31 +121,59 @@ var data = new
107
121
Operation < BinaryData > createResponse = await sentShareClient .CreateOrReplaceSentShareAsync (WaitUntil .Completed , " sentShareId" , RequestContent .Create (data ));
108
122
```
109
123
110
- ### Get a sent share
124
+ #### Get a Sent Share
125
+
126
+ After creating a sent share, data providers can retrieve it.
111
127
112
128
``` C# Snippet:SentSharesClientSample_GetSentShare
113
129
var credential = new DefaultAzureCredential ();
114
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
130
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
115
131
var sentShareClient = new SentSharesClient (endPoint , credential );
116
132
117
133
Response response = await sentShareClient .GetSentShareAsync (" sentShareId" );
118
134
```
119
135
120
- ### List sent shares
136
+ #### List Sent Shares
137
+
138
+ Data providers can also retrieve a list of the sent shares they have created.
121
139
122
140
``` C# Snippet:SentSharesClientSample_ListSentShares
123
141
var credential = new DefaultAzureCredential ();
124
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
142
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
125
143
var sentShareClient = new SentSharesClient (endPoint , credential );
126
144
127
145
List < BinaryData > response = await sentShareClient .GetAllSentSharesAsync (" referenceName" ).ToEnumerableAsync ();
128
146
```
129
147
130
- ### Create a sent share invitation
148
+ #### Create a Share Invitation to a User
149
+
150
+ After creating a sent share, the data provider can extend invitations to consumers who may then view the shared data. In this example, an invitation is extended to an individual by specifying their email address.
151
+
152
+ ``` C# Snippet:SentSharesClientSample_CreateSentShareUserInvitation
153
+ var credential = new DefaultAzureCredential ();
154
+ var endPoint = new Uri (" https://my-account-name.purview.azure.com/share" );
155
+ var sentShareClient = new SentSharesClient (endPoint , credential );
156
+
157
+ var data = new
158
+ {
159
+ invitationKind = " User" ,
160
+ properties = new
161
+ {
162
+ TargetEmail = " [email protected] " ,
163
+ Notify = true ,
164
+ }
165
+ };
166
+
167
+ Response response = await sentShareClient .CreateSentShareInvitationAsync (" sentShareId" , " sentShareInvitationId" , RequestContent .Create (data ));
168
+ ```
169
+
170
+ #### Create a Share Invitation to a Service
171
+
172
+ Data providers can also extend invitations to services or applications by specifying the tenant id and object id of the service. * The object id used for sending an invitation to a service must be the object id associated with the Enterprise Application (not the application registration)* .
131
173
132
174
``` C# Snippet:SentSharesClientSample_CreateSentShareInvitation
133
175
var credential = new DefaultAzureCredential ();
134
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
176
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
135
177
var sentShareClient = new SentSharesClient (endPoint , credential );
136
178
137
179
var data = new
@@ -147,41 +189,84 @@ var data = new
147
189
Response response = await sentShareClient .CreateSentShareInvitationAsync (" sentShareId" , " sentShareInvitationId" , RequestContent .Create (data ));
148
190
```
149
191
150
- ### Get a sent share invitation
192
+ #### Get a sent share invitation
193
+
194
+ After creating a sent share invitation, data providers can retrieve it.
151
195
152
196
``` C# Snippet:SentSharesClientSample_GetSentShareInvitation
153
197
var credential = new DefaultAzureCredential ();
154
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
198
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
155
199
var sentShareClient = new SentSharesClient (endPoint , credential );
156
200
157
201
Response response = await sentShareClient .GetSentShareInvitationAsync (" sentShareId" , " sentShareInvitationId" );
158
202
```
159
203
160
- ### List sent share invitations
204
+ #### List sent share invitations
205
+
206
+ Data providers can also retrieve a list of the sent share invitations they have created.
161
207
162
208
``` C# Snippet:SentSharesClientSample_ListSentShareInvitations
163
209
var credential = new DefaultAzureCredential ();
164
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
210
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
165
211
var sentShareClient = new SentSharesClient (endPoint , credential );
166
212
167
213
List < BinaryData > sentShareInvitations = await sentShareClient .GetAllSentShareInvitationsAsync (" sentShareId" ).ToEnumerableAsync ();
168
214
```
169
215
170
- ### List detached received shares
216
+ #### Delete a sent share invitation
217
+
218
+ Data providers can also retrieve a list of the sent share invitations they have created.
219
+
220
+ ``` C# Snippet:SentSharesClientSample_DeleteSentShareInvitation
221
+ var credential = new DefaultAzureCredential ();
222
+ var endPoint = new Uri (" https://my-account-name.purview.azure.com/share" );
223
+ var sentShareClient = new SentSharesClient (endPoint , credential );
224
+
225
+ Operation operation = await sentShareClient .DeleteSentShareInvitationAsync (WaitUntil .Completed , " sentShareId" , " sentShareInvitationId" );
226
+ ```
227
+
228
+ #### Delete a sent share
229
+
230
+ A sent share can be deleted by the data provider to stop sharing their data with all data consumers.
231
+
232
+ ``` C# Snippet:SentSharesClientSample_DeleteSentShare
233
+ var credential = new DefaultAzureCredential ();
234
+ var endPoint = new Uri (" https://my-account-name.purview.azure.com/share" );
235
+ var sentShareClient = new SentSharesClient (endPoint , credential );
236
+
237
+ Operation operation = await sentShareClient .DeleteSentShareAsync (WaitUntil .Completed , " sentShareId" );
238
+ ```
239
+
240
+ ### Data Consumer Examples
241
+
242
+ The following code examples demonstrate how data consumers can use the Microsoft Azure Java SDK for Purview Sharing to manage their sharing activity.
243
+
244
+ #### Create a Receive Share Client
245
+ ``` C# Snippet:ReceivedSharesClientSample_CreateReceivedSharesClient
246
+ var credential = new DefaultAzureCredential ();
247
+ var endPoint = new Uri (" https://my-account-name.purview.azure.com/share" );
248
+ var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
249
+ ```
250
+
251
+ #### List detached received shares
252
+
253
+ To begin viewing data shared with them, a data consumer must first retrieve a list of detached received shares. Within this list, they can identify a detached received share to attach.
171
254
172
255
``` C# Snippet:ReceivedSharesClientSample_ListDetachedReceivedShares
173
256
var credential = new DefaultAzureCredential ();
174
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
257
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
175
258
var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
176
259
177
260
List < BinaryData > createResponse = await receivedSharesClient .GetAllDetachedReceivedSharesAsync ().ToEnumerableAsync ();
178
261
```
179
262
180
- ### Create a received share
263
+ #### Attach a received share
264
+
265
+ Once the data consumer has identified a received share, they can attach the received share to a location where they can access the shared data. If the received share is already attached, the shared data will be made accessible at the new location specified.
181
266
182
267
``` C# Snippet:ReceivedSharesClientSample_CreateReceivedShare
183
268
var credential = new DefaultAzureCredential ();
184
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
269
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
185
270
var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
186
271
187
272
var data = new
@@ -212,56 +297,59 @@ var data = new
212
297
Operation < BinaryData > createResponse = await receivedSharesClient .CreateOrReplaceReceivedShareAsync (WaitUntil .Completed , " receivedShareId" , RequestContent .Create (data ));
213
298
```
214
299
215
- ### Get a received share
300
+ #### Get a received share
301
+
302
+ A data consumer can retrieve an individual received share.
216
303
217
304
``` C# Snippet:ReceivedSharesClientSample_GetReceivedShare
218
305
var credential = new DefaultAzureCredential ();
219
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
306
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
220
307
var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
221
308
222
309
Response operation = await receivedSharesClient .GetReceivedShareAsync (" receivedShareId" );
223
310
```
224
311
225
- ### List attached received shares
312
+ #### List attached received shares
313
+
314
+ Data consumers can also retrieve a list of their attached received shares.
226
315
227
316
``` C# Snippet:ReceivedSharesClientSample_ListAttachedReceivedShares
228
317
var credential = new DefaultAzureCredential ();
229
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
318
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
230
319
var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
231
320
232
321
List < BinaryData > createResponse = await receivedSharesClient .GetAllAttachedReceivedSharesAsync (" referenceName" ).ToEnumerableAsync ();
233
322
```
234
323
235
- ### Delete a received share
324
+ #### Delete a received share
325
+
326
+ Data consumers can also retrieve a list of their attached received shares.
236
327
237
328
``` C# Snippet:ReceivedSharesClientSample_DeleteReceivedShare
238
329
var credential = new DefaultAzureCredential ();
239
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
330
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
240
331
var receivedSharesClient = new ReceivedSharesClient (endPoint , credential );
241
332
242
333
Operation operation = await receivedSharesClient .DeleteReceivedShareAsync (WaitUntil .Completed , " receivedShareId" );
243
334
```
244
335
245
- ### Delete a sent share invitation
336
+ ### Share Resouce Examples
246
337
247
- ``` C# Snippet:SentSharesClientSample_DeleteSentShareInvitation
248
- var credential = new DefaultAzureCredential ();
249
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
250
- var sentShareClient = new SentSharesClient (endPoint , credential );
338
+ The following code examples demonstrate how to use the Microsoft Azure Java SDK for Purview Sharing to view share resources. A share resource is the underlying resource from which a provider shares data or the destination where a consumer attaches data shared with them.
251
339
252
- Operation operation = await sentShareClient .DeleteSentShareInvitationAsync (WaitUntil .Completed , " sentShareId" , " sentShareInvitationId" );
253
- ```
340
+ #### List share resources
254
341
255
- ### Delete a sent share
342
+ A list of share resources can be retrieved to view all resources within an account where sharing activities have taken place.
256
343
257
- ``` C# Snippet:SentSharesClientSample_DeleteSentShare
344
+ ``` C# Snippet:ShareResourcesClientExample_ListShareResources
258
345
var credential = new DefaultAzureCredential ();
259
- var endPoint = " https://my-account-name.purview.azure.com/share" ;
260
- var sentShareClient = new SentSharesClient (endPoint , credential );
346
+ var endPoint = new Uri ( " https://my-account-name.purview.azure.com/share" ) ;
347
+ var shareResourcesClient = new ShareResourcesClient (endPoint , credential );
261
348
262
- Operation operation = await sentShareClient . DeleteSentShareAsync ( WaitUntil . Completed , " sentShareId " );
349
+ List < BinaryData > createResponse = await shareResourcesClient . GetAllShareResourcesAsync (). ToEnumerableAsync ( );
263
350
```
264
351
352
+
265
353
## Troubleshooting
266
354
267
355
### Setting up console logging
0 commit comments